diff -r 15927a4f5c19 -r 4bf0f6ff748d src_js/iconolab-bundle/src/components/editor/Canvas.vue --- a/src_js/iconolab-bundle/src/components/editor/Canvas.vue Wed Feb 22 16:28:03 2017 +0100 +++ b/src_js/iconolab-bundle/src/components/editor/Canvas.vue Wed Feb 22 16:29:02 2017 +0100 @@ -4,7 +4,13 @@ - + { - console.log('Viewport: %s x %s', - this.paper.node.clientWidth, this.paper.node.clientHeight); + var bcr = this.paper.node.getBoundingClientRect(); + + console.log('Viewport: %s x %s', bcr.width, bcr.height); var viewBox = [0 , 0, img.width, img.height]; var viewport = { - width: this.paper.node.clientWidth, - height: this.paper.node.clientHeight + width: bcr.width, + height: bcr.height }; Object.assign(this, { @@ -465,11 +474,12 @@ if (this.$refs.rect.width === 0 && this.$refs.rect.height === 0) { var currentPosition = this.computeOffset(e); + var size = this.imgMinSize / 4; Object.assign(this.$refs.rect, { - x: currentPosition.x, - y: currentPosition.y, - width: this.imgMinSize / 4, - height: this.imgMinSize / 4, + x: currentPosition.x - (size / 2), + y: currentPosition.y - (size / 2), + width: size, + height: size, }); }