|
|
@@ -27,7 +27,9 @@ export default {
|
|
|
program: null,
|
|
|
snapping: false,
|
|
|
loading: true,
|
|
|
- scale: 1,
|
|
|
+ scale: 100,
|
|
|
+ minScale: 100,
|
|
|
+ maxScale: 100,
|
|
|
selectedWidgetIndex: -1,
|
|
|
node: null,
|
|
|
bgm: '',
|
|
|
@@ -37,7 +39,7 @@ export default {
|
|
|
computed: {
|
|
|
transformStyles () {
|
|
|
return {
|
|
|
- transform: `scale(${this.scale})`,
|
|
|
+ transform: `scale(${this.scale / 100})`,
|
|
|
'transform-origin': '0 0'
|
|
|
}
|
|
|
},
|
|
|
@@ -47,7 +49,7 @@ export default {
|
|
|
return {
|
|
|
width: `${width}px`,
|
|
|
height: `${height}px`,
|
|
|
- 'background-color': backgroundColor,
|
|
|
+ color: backgroundColor,
|
|
|
'background-image': backgroundImage[0] ? `url("${getThumbnailUrl(backgroundImage[0].keyName)}")` : 'none'
|
|
|
}
|
|
|
}
|
|
|
@@ -150,16 +152,19 @@ export default {
|
|
|
const width = wrapper.offsetWidth
|
|
|
const height = wrapper.offsetHeight
|
|
|
const { width: cWidth, height: cHeight } = this.node
|
|
|
+ const wScale = width / cWidth
|
|
|
+ const hScale = height / cHeight
|
|
|
if (cWidth > width || cHeight > height) {
|
|
|
- const wScale = width / cWidth
|
|
|
- const hScale = height / cHeight
|
|
|
- this.scale = Math.min(wScale, hScale)
|
|
|
- console.log('wScale vs hScale', wScale, hScale)
|
|
|
+ this.scale = Math.min(wScale, hScale) * 100 | 0
|
|
|
+ this.maxScale = Math.max(1, wScale, hScale) * 100 | 0
|
|
|
} else {
|
|
|
- this.scale = 1
|
|
|
+ this.scale = 100
|
|
|
+ this.maxScale = Math.max(2, wScale, hScale) * 100 | 0
|
|
|
}
|
|
|
- console.log('width: layout -> window', cWidth, '->', width)
|
|
|
- console.log('height: layout -> window', cHeight, '->', height)
|
|
|
+ this.minScale = this.scale
|
|
|
+ console.log('width: layout -> window', cWidth, '->', width, wScale)
|
|
|
+ console.log('height: layout -> window', cHeight, '->', height, hScale)
|
|
|
+ console.log(this.scale, this.maxScale)
|
|
|
}
|
|
|
},
|
|
|
showMessage (type, message) {
|
|
|
@@ -289,8 +294,8 @@ export default {
|
|
|
}
|
|
|
return tagName !== 'VIDEO' && tagName !== 'IFRAME'
|
|
|
},
|
|
|
- width: this.node.width * this.scale | 0,
|
|
|
- height: this.node.height * this.scale | 0,
|
|
|
+ width: this.node.width * this.scale / 100 | 0,
|
|
|
+ height: this.node.height * this.scale / 100 | 0,
|
|
|
quality: 0.1
|
|
|
}).finally(() => {
|
|
|
this.snapping = false
|