diff --git a/src/canvas/index.js b/src/canvas/index.js index 9b500e97d..a035c53f9 100644 --- a/src/canvas/index.js +++ b/src/canvas/index.js @@ -62,13 +62,14 @@ module.exports = () => { * @param {Object} config Configurations * @private */ - init(config) { - c = config || {}; - for (var name in defaults) { - if (!(name in c)) c[name] = defaults[name]; - } + init(config = {}) { + c = { + ...defaults, + ...config + }; - var ppfx = c.pStylePrefix; + this.em = c.em; + const ppfx = c.pStylePrefix; if (ppfx) c.stylePrefix = ppfx + c.stylePrefix; canvas = new Canvas(config); @@ -463,7 +464,7 @@ module.exports = () => { updateClientY(ev) { ev.preventDefault(); - this.lastClientY = getPointerEvent(ev).clientY; + this.lastClientY = getPointerEvent(ev).clientY * this.em.getZoomDecimal(); }, /** @@ -503,7 +504,7 @@ module.exports = () => { }, getScrollListeners() { - return [this.getFrameEl().contentWindow, this.getElement()]; + return [this.getFrameEl().contentWindow]; }, postRender() { diff --git a/src/commands/view/SelectComponent.js b/src/commands/view/SelectComponent.js index d4b948db1..3578480dc 100644 --- a/src/commands/view/SelectComponent.js +++ b/src/commands/view/SelectComponent.js @@ -266,7 +266,6 @@ module.exports = { * @private * */ updateBadge(el, pos) { - const { em } = this; var $el = $(el); var canvas = this.canvas; var config = canvas.getConfig(); @@ -281,7 +280,7 @@ module.exports = { var bStyle = badge.style; var u = 'px'; bStyle.display = 'block'; - var canvasPos = canvas.getCanvasView().getPosition(); + var canvasPos = this.getCanvasPosition(); if (canvasPos) { const canvasTop = canvasPos.top;