Browse Source

Take into account full size of elements while dragging

pull/187/head
Artur Arseniev 9 years ago
parent
commit
8fbfb973f6
  1. 13
      src/utils/Sorter.js

13
src/utils/Sorter.js

@ -548,10 +548,15 @@ module.exports = Backbone.View.extend({
if (this.canvasRelative && this.em) { if (this.canvasRelative && this.em) {
var pos = this.em.get('Canvas').getElementPos(el); var pos = this.em.get('Canvas').getElementPos(el);
top = pos.top; var styles = window.getComputedStyle(el);
left = pos.left; var marginTop = parseFloat(styles['marginTop']);
height = pos.height; var marginBottom = parseFloat(styles['marginBottom']);
width = pos.width; var marginRight = parseFloat(styles['marginRight']);
var marginLeft = parseFloat(styles['marginLeft']);
top = pos.top - marginTop;
left = pos.left - marginLeft;
height = pos.height + marginTop + marginBottom;
width = pos.width + marginLeft + marginRight;
} else { } else {
var o = this.offset(el); var o = this.offset(el);
top = this.relative ? el.offsetTop : o.top - (this.wmargin ? -1 : 1) * this.elT; top = this.relative ? el.offsetTop : o.top - (this.wmargin ? -1 : 1) * this.elT;

Loading…
Cancel
Save