diff --git a/src/canvas/view/FrameWrapView.js b/src/canvas/view/FrameWrapView.js index 531738710..73ae487e6 100644 --- a/src/canvas/view/FrameWrapView.js +++ b/src/canvas/view/FrameWrapView.js @@ -68,7 +68,20 @@ export default Backbone.View.extend({
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
` ); diff --git a/src/commands/view/SelectComponent.js b/src/commands/view/SelectComponent.js index 1b05fbe61..0e77876dd 100644 --- a/src/commands/view/SelectComponent.js +++ b/src/commands/view/SelectComponent.js @@ -183,7 +183,6 @@ export default { */ showElementOffset(el, pos, opts = {}) { if (!showOffsets) return; - this.editor.runCommand('show-offset', { el, elPos: pos, @@ -647,7 +646,7 @@ export default { * @private */ onFrameScroll() { - this.updateToolsLocal(); + // this.updateToolsLocal(); this.updateToolsGlobal(); }, diff --git a/src/commands/view/ShowOffset.js b/src/commands/view/ShowOffset.js index 44c01c847..8bd904f73 100644 --- a/src/commands/view/ShowOffset.js +++ b/src/commands/view/ShowOffset.js @@ -42,14 +42,26 @@ export default { var offsetViewer = canvas[method](opts.view); offsetViewer.style.opacity = ''; - var marginT = this['marginT' + state]; - var marginB = this['marginB' + state]; - var marginL = this['marginL' + state]; - var marginR = this['marginR' + state]; - var padT = this['padT' + state]; - var padB = this['padB' + state]; - var padL = this['padL' + state]; - var padR = this['padR' + state]; + let marginT = this['marginT' + state]; + let marginB = this['marginB' + state]; + let marginL = this['marginL' + state]; + let marginR = this['marginR' + state]; + let padT = this['padT' + state]; + let padB = this['padB' + state]; + let padL = this['padL' + state]; + let padR = this['padR' + state]; + + if (offsetViewer.childNodes.length) { + this[stateVar] = '1'; + marginT = offsetViewer.querySelector('[data-offset-m-t]'); + marginB = offsetViewer.querySelector('[data-offset-m-b]'); + marginL = offsetViewer.querySelector('[data-offset-m-l]'); + marginR = offsetViewer.querySelector('[data-offset-m-r]'); + padT = offsetViewer.querySelector('[data-offset-p-t]'); + padB = offsetViewer.querySelector('[data-offset-p-b]'); + padL = offsetViewer.querySelector('[data-offset-p-l]'); + padR = offsetViewer.querySelector('[data-offset-p-r]'); + } if (!this[stateVar]) { var stateLow = state.toLowerCase();