188 Commits

Author SHA1 Message Date
oceanzhu
164d777ebf refactor(stage): 将被操作元素和拖拽框抽取出来放到DragResizeHelper中
Squash merge branch 'feature/ocean_stagerefactor_880128993' into 'master'
refactor(stage): 在拖拽过程中,moveable会产生一些状态事件,DragResizeHelper对这些状态事件中对将被操作元素和拖拽框的状态和dom进行处理。
2022-11-29 09:51:41 +00:00
oceanzhu
3fb880d09b refactor(stage):重构魔方编辑器stage代码
Squash merge branch 'feature/oc_actionbox_879360293' into 'master'
    对魔方编辑器核心代码stage进行重构,这部分代码主要是负责编辑器中间画布区域的处理,包括渲染一个所见即所得的画布,支持组件的增删改查和拖拽、高亮操作。
    旧代码存在的问题以及解决方案:
    1、过多暴露属性和循环引用,导致stageCore、stageDragResize、StageMultiDragResize、StageRender、StageMask、StageHighlight之间形成复杂的网状依赖,非常不可控。StageCore负责创建后面5个类的实例,并把这些实例作为自己的公共属性,同时core把自己的this传给这些实例,这些实例就会通过core传进来的this,通过core间接的访问其它实例的方法和属性,比如在stageDragResize中可能存在这样的一个访问:this.core.stageRender.contentWindow.document
    解决方案:
    1)、属性尽量设置为私有,对外暴露方法,不暴露属性;
    2)、core避免向其它类传递this,改为传递接口,需要什么就传什么

    2、事件传递较多,跳来跳去,定位问题较为困难
    解决方案:
    重新梳理各个类的职责,尽量在类中闭环,减少事件传递。
    新增了actionManager类,core负责管理render、mask、actionManager三个类;
    actionManager负责管理单选、多选、高亮三个类,同时将mask中的事件监听,转移到actionManager监听,actionManager形成单选、多选、高亮行为后,直接调动单选、多选、高亮完成功能。

    3、存在一些重复代码
    主要是拖拽框的代码在单选、多选、高亮中各自维护,改为统一维护

    4、多选不支持辅助线对齐
    将单选中的moveableOption管理逻辑抽取出来成为单选和多选的父类,使多选支持辅助线对齐

    本次改动取消了一些对外暴露的属性,moveableOption回调函数签名也有变化,详细情况如下:
    删除stageCore公共属性:
    public selectedDom: HTMLElement | undefined;
    public selectedDomList: HTMLElement[] = [];
    public highlightedDom: Element | undefined;
    public dr: StageDragResize;
    public multiDr: StageMultiDragResize;
    public highlightLayer: StageHighlight;
    public config: StageCoreConfig;
    public zoom = DEFAULT_ZOOM;
    public containerHighlightClassName: string;
    public containerHighlightDuration: number;
    public containerHighlightType?: ContainerHighlightType;
    public isContainer: IsContainer;

    stageCore入参改动:
    这两个参数原本定义:
    moveableOptions?: ((core?: StageCore) => MoveableOptions) | MoveableOptions;
    multiMoveableOptions?: ((core?: StageCore) => MoveableOptions) | MoveableOptions;
    修改后定义:
    moveableOptions?: CustomizeMoveableOptions;
    multiMoveableOptions?: CustomizeMoveableOptions;
    CustomizeMoveableOptions =
      | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)
      | MoveableOptions
      | undefined;
    export interface CustomizeMoveableOptionsCallbackConfig {
      targetElId?: string;
    }
2022-11-24 21:19:56 +08:00
roymondchen
deeb55cd0b chore: release v1.2.0-beta.18 2022-11-24 21:04:33 +08:00
roymondchen
76a8eee6c5 chore: release v1.2.0-beta.17 2022-11-24 15:27:37 +08:00
roymondchen
f44500d21b chore: release v1.2.0-beta.16 2022-11-23 18:52:24 +08:00
roymondchen
a4f9467d53 chore: release v1.2.0-beta.15 2022-11-22 16:41:50 +08:00
roymondchen
f0d6624fc4 chore: release v1.2.0-beta.14 2022-11-18 18:12:58 +08:00
roymondchen
a575073387 chore: release v1.2.0-beta.13 2022-11-15 18:19:57 +08:00
roymondchen
52fc452823 chore: release v1.2.0-beta.12 2022-11-15 16:58:27 +08:00
roymondchen
2bbca87e51 chore: release v1.2.0-beta.11 2022-11-08 16:23:29 +08:00
roymondchen
d8d6342505 chore: release v1.2.0-beta.10 2022-11-07 16:31:40 +08:00
roymondchen
131ae30bae chore: 添加组件name 2022-11-03 14:14:54 +08:00
roymondchen
bb01427a42 chore: release v1.2.0-beta.9 2022-10-28 19:20:04 +08:00
roymondchen
73ecdfff70 chore: release v1.2.0-beta.8 2022-10-25 17:41:35 +08:00
oceanzhu
2dda4f3488 refactor(stage): 删除stageCore构造函数的参数,修改了getScrollParent的实现,无需依赖外部传参数 2022-10-25 09:19:13 +00:00
oceanzhu
554e695ef5 refactor(stage): 根据cr意见优化stageRender构造函数传参 2022-10-25 09:19:13 +00:00
oceanzhu
9787a9e379 refactor(stage): 重构mask,解除对stageCore对象的依赖,同时减少暴露的对象,并重构部分大函数为小函数 2022-10-25 09:19:13 +00:00
oceanzhu
638e996516 refactor(stage): stageRender去除对stageCore对象的依赖,简化对象依赖关系 2022-10-25 09:19:13 +00:00
oceanzhu
f416530d38 fix(stage): 修复辅助线显隐的bug
fix #444
2022-10-20 20:40:13 +08:00
roymondchen
11e0e04cbd feat(editor,stage): 在画布中支持选择父组件
close #403
2022-10-20 19:52:53 +08:00
roymondchen
f9682a7b70 chore: release v1.2.0-beta.7 2022-10-17 16:03:29 +08:00
roymondchen
f6af025355 chore: release v1.2.0-beta.6 2022-10-14 18:52:37 +08:00
roymondchen
8c5518170d chore: release v1.2.0-beta.5 2022-10-12 19:21:24 +08:00
roymondchen
d5e8a77821 chore: release v1.2.0-beta.4 2022-10-12 16:31:14 +08:00
roymondchen
3baf6ffffc chore: release v1.2.0-beta.3 2022-10-12 15:42:02 +08:00
roymondchen
b77cf108cd fix(stage): 页面布局修改为流式布局后,组件宽可以设置到边框之外
fix #395
2022-10-12 15:39:27 +08:00
khuntoriia
e3b7f587ee
feat(editor): 支持通过左侧组件树进行组件多选
* feat(layerpanel): 支持通过组件树对组件进行多选

* feat(editor): 重构LayerPanel为ts setup语法形式

* feat(editor): 组件列表选中节点与高亮节点时的逻辑优化,两种形态互斥处理

* fix(editor): 修复按住ctrl不放但鼠标移出的layerpanel时选择模式无法复原的问题,修复点击组件树index多选框可进行选择的问题

* fix(editor): 修复多选场景点击组件树节点取消多选时,节点高亮样式冲突的问题

close #404 

Co-authored-by: parisma <parisma@tencent.com>
2022-10-10 13:57:24 +08:00
roymondchen
7da3509bd0 chore: release v1.2.0-beta.2 2022-09-28 16:45:58 +08:00
roymondchen
bbb5927e0c fix(stage): 旋转、缩放组件后没有更新dsl 2022-09-27 18:23:19 +08:00
roymondchen
b50f6a9fbf chore: release v1.2.0-beta.1 2022-09-22 17:13:21 +08:00
parisma
09c9af8454 fix(stage): 修复ctrl+tab切到其他窗口引起多选状态混乱的问题 2022-09-22 16:46:11 +08:00
roymondchen
66c5daca49 chore: release v1.1.6 2022-09-22 16:00:43 +08:00
roymondchen
cebb152416 chore: release v1.1.5 2022-09-20 15:31:04 +08:00
roymondchen
6d91cacc84 build: vite依赖升级 2022-09-20 13:18:32 +08:00
roymondchen
d748090b5c chore: release v1.1.4 2022-09-15 14:47:56 +08:00
roymondchen
33a09cccc7 fix(stage): 当选中的组件与上一次选中的组件有重叠时,选中后的下一个click事件丢失 2022-09-14 18:33:19 +08:00
roymondchen
66579793c2 chore: release v1.1.3 2022-09-13 14:32:48 +08:00
roymondchen
601528d752 chore: release v1.1.2 2022-09-08 12:48:44 +08:00
roymondchen
d84c6d08c3 chore: release v1.1.1 2022-08-31 15:14:05 +08:00
roymondchen
53f36bcebb chore: release v1.1.0 2022-08-30 20:18:50 +08:00
roymondchen
793d02a706 feat(stage): 多选支持resize
close #302
2022-08-30 17:56:53 +08:00
roymondchen
2201fbe80c fix(editor,stage,ui,runtime): 流式布局下,height自动设置成auto
fix #298
2022-08-30 17:38:42 +08:00
roymondchen
9e167474a2 fix(stage): 流式布局resize从上或者左边调整,选中框出现错位
fix #297
2022-08-30 14:32:06 +08:00
roymondchen
7dfb0ea7b6 chore: release v1.1.0-beta.13 2022-08-29 12:18:18 +08:00
roymondchen
091bf37b6d chore: release v1.1.0-beta.12 2022-08-24 11:04:08 +08:00
i33
f3c9ba475f
fix(editor): 拖拽改变父容器时错乱现象 (#296)
* fix(editor): 拖拽改变父容器时错乱现象

直接拖拽元素改变其父容器时, 会产生错乱的现象。

* Update packages/stage/src/types.ts

Co-authored-by: jia000 <398009049@qq.com>

Co-authored-by: jia000 <398009049@qq.com>
2022-08-22 13:18:23 +08:00
roymondchen
6cc1d8e3c0 chore: release v1.1.0-beta.11 2022-08-19 11:25:10 +08:00
roymondchen
6573e8606f chore: release v1.1.0-beta.10 2022-08-17 15:29:57 +08:00
roymondchen
2cde4bb5a0 feat(editor): runtime add api中parent参数加回去 2022-08-16 16:29:32 +08:00
roymondchen
59e6aff70a feat(editor,stage): runtime-api中的add/update/remove中的参数加上parentId 2022-08-16 15:20:39 +08:00