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 **/
|
||||
const toOffsetBounds = (clientBounds, offsetContainer) => {
|
||||
const { x, y } = offsetContainer.getBoundingClientRect();
|
||||
const left = Math.round(clientBounds.left - x);
|
||||
const top = Math.round(clientBounds.top - y);
|
||||
const { top, left } = offsetContainer.getBoundingClientRect();
|
||||
const l = Math.round(clientBounds.left - left);
|
||||
const t = Math.round(clientBounds.top - top);
|
||||
|
||||
return {
|
||||
left : left,
|
||||
top : top,
|
||||
right : Math.round(left + clientBounds.width),
|
||||
bottom: Math.round(top + clientBounds.height),
|
||||
left : l,
|
||||
top : t,
|
||||
right : Math.round(l + clientBounds.width),
|
||||
bottom: Math.round(t + clientBounds.height),
|
||||
width : Math.round(clientBounds.width),
|
||||
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) {
|
||||
this.currentConnection.dragTo(this.currentHover.node);
|
||||
} else {
|
||||
const { x, y } = this.contentEl.getBoundingClientRect();
|
||||
this.currentConnection.dragTo([ evt.pageX - x, evt.pageY - y]);
|
||||
const { top, left } = this.contentEl.getBoundingClientRect();
|
||||
this.currentConnection.dragTo([ evt.pageX - left, evt.pageY - top ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue