Merge pull request #137 from bradymadden97/master
[bugfix] fix drag out of window for move/resize shape
This commit is contained in:
commit
4ad49ff970
@ -1107,13 +1107,8 @@ class App extends React.Component<{}, AppState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const x =
|
const x =
|
||||||
e.clientX -
|
e.clientX - CANVAS_WINDOW_OFFSET_LEFT - this.state.scrollX;
|
||||||
(e.target as HTMLElement).offsetLeft -
|
const y = e.clientY - CANVAS_WINDOW_OFFSET_TOP - this.state.scrollY;
|
||||||
this.state.scrollX;
|
|
||||||
const y =
|
|
||||||
e.clientY -
|
|
||||||
(e.target as HTMLElement).offsetTop -
|
|
||||||
this.state.scrollY;
|
|
||||||
const element = newElement(
|
const element = newElement(
|
||||||
this.state.elementType,
|
this.state.elementType,
|
||||||
x,
|
x,
|
||||||
@ -1291,8 +1286,10 @@ class App extends React.Component<{}, AppState> {
|
|||||||
if (isDraggingElements) {
|
if (isDraggingElements) {
|
||||||
const selectedElements = elements.filter(el => el.isSelected);
|
const selectedElements = elements.filter(el => el.isSelected);
|
||||||
if (selectedElements.length) {
|
if (selectedElements.length) {
|
||||||
const x = e.clientX - target.offsetLeft - this.state.scrollX;
|
const x =
|
||||||
const y = e.clientY - target.offsetTop - this.state.scrollY;
|
e.clientX - CANVAS_WINDOW_OFFSET_LEFT - this.state.scrollX;
|
||||||
|
const y =
|
||||||
|
e.clientY - CANVAS_WINDOW_OFFSET_TOP - this.state.scrollY;
|
||||||
selectedElements.forEach(element => {
|
selectedElements.forEach(element => {
|
||||||
element.x += x - lastX;
|
element.x += x - lastX;
|
||||||
element.y += y - lastY;
|
element.y += y - lastY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user