update 0.7.4

This commit is contained in:
hufeixiong
2021-07-29 11:01:48 +08:00
parent 6328bfb17d
commit aa219eac04
7 changed files with 79 additions and 23 deletions

View File

@@ -50,8 +50,8 @@ export const innerDrag = function (
innerDragState.startX = Math.round(e.clientX);
innerDragState.startY = Math.round(e.clientY);
innerDragState.item = item;
innerDragState.itemX = item.left;
innerDragState.itemY = item.top;
// innerDragState.itemX = item.left; 会导致框选后移动问题
// innerDragState.itemY = item.top;
innerDragState.isDrag = true;
innerDragState.ref = ref;
innerDragState.current = store.getIndex();
@@ -87,21 +87,23 @@ export const innerContainerDrag = function (config: UserConfig) {
lastblock = innerDragState.item;
newblock = cloneblock.map((v) => {
if (v.focus && v.position !== 'static') {
v.left = Math.round(innerDragState.itemX + durX);
v.top = Math.round(innerDragState.itemY + durY);
v.left = Math.round(v.left + durX);
v.top = Math.round(v.top + durY);
}
return v;
});
} else {
newblock = store.getData().block.map((v) => {
if (v.focus && v.position !== 'static') {
v.left = Math.round(innerDragState.itemX + durX);
v.top = Math.round(innerDragState.itemY + durY);
v.left = Math.round(v.left + durX);
v.top = Math.round(v.top + durY);
}
return v;
});
}
store.setData({ ...store.getData(), block: newblock });
innerDragState.startX = moveX;
innerDragState.startY = moveY;
}
resizerMouseMove(e, config);
rotateMouseMove(e, config);

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-03-14 12:09:11
* @LastEditors: yehuozhili
* @LastEditTime: 2021-07-27 11:40:39
* @LastEditTime: 2021-07-29 10:48:29
* @FilePath: \dooringx\packages\dooringx-lib\src\core\innerDrag\state.ts
*/
import { RefObject } from 'react';
@@ -17,8 +17,8 @@ export interface innerDragStateType {
ref: RefObject<HTMLDivElement> | null;
current: number;
lastClick: null | IBlockType;
itemX: number;
itemY: number;
// itemX: number;
// itemY: number;
}
export const innerDragState: innerDragStateType = {
@@ -29,6 +29,6 @@ export const innerDragState: innerDragStateType = {
ref: null,
current: 0,
lastClick: null,
itemX: 0,
itemY: 0,
// itemX: 0,
// itemY: 0,
};