Artur Arseniev
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
10 additions and
10 deletions
-
src/canvas/view/CanvasView.js
-
src/canvas/view/FrameView.js
-
src/utils/Sorter.js
|
|
|
@ -262,7 +262,7 @@ export default Backbone.View.extend({ |
|
|
|
body.append(this.getJsContainer()); |
|
|
|
em.trigger('loaded'); |
|
|
|
this.frame.el.contentWindow.onscroll = this.onFrameScroll; |
|
|
|
this.frame.udpateOffset(); |
|
|
|
this.frame.updateOffset(); |
|
|
|
|
|
|
|
// Avoid the default link behaviour in the canvas
|
|
|
|
body.on( |
|
|
|
|
|
|
|
@ -13,7 +13,7 @@ export default Backbone.View.extend({ |
|
|
|
}, |
|
|
|
|
|
|
|
initialize(o) { |
|
|
|
bindAll(this, 'udpateOffset'); |
|
|
|
bindAll(this, 'updateOffset'); |
|
|
|
this.config = o.config || {}; |
|
|
|
this.ppfx = this.config.pStylePrefix || ''; |
|
|
|
this.em = this.config.em; |
|
|
|
@ -45,19 +45,19 @@ export default Backbone.View.extend({ |
|
|
|
const noChanges = currW == newW && currH == newH; |
|
|
|
style.width = newW; |
|
|
|
style.height = newH; |
|
|
|
this.udpateOffset(); |
|
|
|
this.updateOffset(); |
|
|
|
// Prevent fixed highlighting box which appears when on
|
|
|
|
// component hover during the animation
|
|
|
|
em.stopDefault({ preserveSelected: 1 }); |
|
|
|
noChanges ? this.udpateOffset() : $el.on(motionsEv, this.udpateOffset); |
|
|
|
noChanges ? this.updateOffset() : $el.on(motionsEv, this.updateOffset); |
|
|
|
}, |
|
|
|
|
|
|
|
udpateOffset() { |
|
|
|
updateOffset() { |
|
|
|
const em = this.em; |
|
|
|
const offset = em.get('Canvas').getOffset(); |
|
|
|
em.set('canvasOffset', offset); |
|
|
|
em.runDefault({ preserveSelected: 1 }); |
|
|
|
this.$el.off(motionsEv, this.udpateOffset); |
|
|
|
this.$el.off(motionsEv, this.updateOffset); |
|
|
|
}, |
|
|
|
|
|
|
|
getDoc() { |
|
|
|
|
|
|
|
@ -27,7 +27,7 @@ export default Backbone.View.extend({ |
|
|
|
'onMove', |
|
|
|
'endMove', |
|
|
|
'rollback', |
|
|
|
'udpateOffset', |
|
|
|
'updateOffset', |
|
|
|
'moveDragHelper' |
|
|
|
); |
|
|
|
var o = opt || {}; |
|
|
|
@ -69,8 +69,8 @@ export default Backbone.View.extend({ |
|
|
|
this.activeTextModel = null; |
|
|
|
|
|
|
|
if (this.em && this.em.on) { |
|
|
|
this.em.on('change:canvasOffset', this.udpateOffset); |
|
|
|
this.udpateOffset(); |
|
|
|
this.em.on('change:canvasOffset', this.updateOffset); |
|
|
|
this.updateOffset(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
@ -98,7 +98,7 @@ export default Backbone.View.extend({ |
|
|
|
/** |
|
|
|
* Triggered when the offset of the editro is changed |
|
|
|
*/ |
|
|
|
udpateOffset() { |
|
|
|
updateOffset() { |
|
|
|
const offset = this.em.get('canvasOffset') || {}; |
|
|
|
this.offTop = offset.top; |
|
|
|
this.offLeft = offset.left; |
|
|
|
|