Made SVG drawing MS Edge compatible (issue #7)
This commit is contained in:
parent
41529a4cd1
commit
eedbe77e22
|
@ -47,15 +47,15 @@ export default class Bounds {
|
||||||
|
|
||||||
/** Translates DOMRect client bounds to offset bounds within the given container **/
|
/** Translates DOMRect client bounds to offset bounds within the given container **/
|
||||||
const toOffsetBounds = (clientBounds, offsetContainer) => {
|
const toOffsetBounds = (clientBounds, offsetContainer) => {
|
||||||
const { x, y } = offsetContainer.getBoundingClientRect();
|
const { top, left } = offsetContainer.getBoundingClientRect();
|
||||||
const left = Math.round(clientBounds.left - x);
|
const l = Math.round(clientBounds.left - left);
|
||||||
const top = Math.round(clientBounds.top - y);
|
const t = Math.round(clientBounds.top - top);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
left : left,
|
left : l,
|
||||||
top : top,
|
top : t,
|
||||||
right : Math.round(left + clientBounds.width),
|
right : Math.round(l + clientBounds.width),
|
||||||
bottom: Math.round(top + clientBounds.height),
|
bottom: Math.round(t + clientBounds.height),
|
||||||
width : Math.round(clientBounds.width),
|
width : Math.round(clientBounds.width),
|
||||||
height: Math.round(clientBounds.height)
|
height: Math.round(clientBounds.height)
|
||||||
};
|
};
|
||||||
|
|
|
@ -245,4 +245,3 @@ export default class Connection extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ export default class DrawingTool extends EventEmitter {
|
||||||
if (this.currentHover) {
|
if (this.currentHover) {
|
||||||
this.currentConnection.dragTo(this.currentHover.node);
|
this.currentConnection.dragTo(this.currentHover.node);
|
||||||
} else {
|
} else {
|
||||||
const { x, y } = this.contentEl.getBoundingClientRect();
|
const { top, left } = this.contentEl.getBoundingClientRect();
|
||||||
this.currentConnection.dragTo([ evt.pageX - x, evt.pageY - y]);
|
this.currentConnection.dragTo([ evt.pageX - left, evt.pageY - top ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue