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

@@ -1,11 +1,51 @@
<!--
* @Author: yehuozhili
* @Date: 2021-01-31 20:44:16
* @LastEditors: yehuozhili
* @LastEditTime: 2021-07-28 14:30:45
* @FilePath: \dooringx\packages\dooringx-lib\README.md
-->
<div align=center >
<img src="https://img-blog.csdnimg.cn/img_convert/520863a38a93d960862f92c805bc97cc.png#pic_center"/>
</div>
## Dooringx-lib
lib主包
dooringx-lib 是 dooringx 的基座,是移除了 dooringx 插件的可视化拖拽框架。
dooringx-lib 提供自己的一套数据流事件机制以及弹窗等解决方案,可以让你更快地自己定制开发可视化拖拽平台。
<img src="https://yehuozhili-1259443377.cos.ap-nanjing.myqcloud.com/xxa.jpg"/>
<img src="https://yehuozhili-1259443377.cos.ap-nanjing.myqcloud.com/xxb.jpg"/>
dooringx-lib 在运行时维护一套数据流主要分为json数据部分左侧组件部分右侧配置项部分快捷键部分弹窗部分事件与函数部分数据源部分。
其除了提供基础的拖拽、移动、缩放、全选、旋转等功能外,还可以使用暴露的组件。如果觉得组件不够定制化,可以调整样式或者自己重新写。
### 安装
使用 npm 或者 yarn 安装
```
npm i dooringx-lib
```
### 文档
详情见文档 https://h5-dooring.github.io/dooringx/
### 问题
有问题提issue或联系qq:673632758

View File

@@ -1,5 +1,5 @@
{
"version": "0.7.3",
"version": "0.7.4",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/dooringx-lib.esm.js",

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,
};