assets/js/frame.js in appscms-tools-theme-2.5.8 vs assets/js/frame.js in appscms-tools-theme-2.5.9
- old
+ new
@@ -68,24 +68,35 @@
ctx.filter = item.filter
}
if (item.rotate) {
ctx.rotate((item.rotate * Math.PI) / 180)
}
-
- ctx.drawImage(
- image,
- Number(item.x),
- Number(item.y),
- image.width,
- image.height
- )
+ let perspectiveKey = 'perspective' in item
+ if (!perspectiveKey) {
+ ctx.drawImage(
+ image,
+ Number(item.x),
+ Number(item.y),
+ image.width,
+ image.height
+ )
+ }
if (item.translate) {
ctx.translate(item.translate.x, item.translate.y)
}
if (item.skew) {
ctx.setTransform(1, item.skew.x, item.skew.y, 1, 0, 0)
}
+ if (perspectiveKey) {
+ let p = new Perspective(ctx, image)
+ p.draw([
+ [item.perspective.topLeft.x, item.perspective.topLeft.y],
+ [item.perspective.topRight.x, item.perspective.topRight.y],
+ [item.perspective.bottomRight.x, item.perspective.bottomRight.y],
+ [item.perspective.bottomLeft.x, item.perspective.bottomLeft.y],
+ ])
+ }
ctx.restore()
resolve()
}
})
}
@@ -245,15 +256,5 @@
window.location.href = `/download?tool=${pageTool}`
} else {
window.location.href = `/${lang}/download?tool=${pageTool}`
}
})
-
-//
-// fonts
-// font rotation
-// font position
-// font transform
-
-//images
-//image rotation
-// image rectangle with text