1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import React from 'react'
import { generateTransform, unitsDimension } from 'app/views/tile/tile.utils'
export default function TileScript({ tile, box, bounds, videoBounds, viewing, onMouseDown, onDoubleClick }) {
// console.log(tile)
const style = {
transform: generateTransform(tile, box, bounds, videoBounds),
opacity: tile.settings.opacity,
}
// console.log(generateTransform(tile))
let className = ['tile', tile.type].join(' ')
if (tile.target_page_id || (viewing && tile.href)) {
if (viewing || tile.settings.cursor !== 'unclickable') {
className += ' ' + (tile.settings.cursor || 'hand_up')
}
}
if (!tile.settings.content) {
return null
}
let content = <span dangerouslySetInnerHTML={{ __html: tile.settings.content }} />
className += ' ' + tile.settings.align
style.width = unitsDimension(tile, 'width', bounds, videoBounds)
style.height = unitsDimension(tile, 'height', bounds, videoBounds)
style.fontFamily = tile.settings.font_family
style.fontSize = tile.settings.font_size + 'px'
style.lineHeight = 1.5
style.fontWeight = (tile.settings.font_style || "").indexOf('bold') !== -1 ? 'bold' : 'normal'
style.fontStyle = (tile.settings.font_style || "").indexOf('italic') !== -1 ? 'italic' : 'normal'
style.backgroundColor = tile.settings.background_color || 'transparent'
style.color = tile.settings.font_color || '#dddddd!important'
return (
<div
className={className}
onMouseDown={onMouseDown}
onDoubleClick={onDoubleClick}
style={style}
>
{content}
</div>
)
}
|