Comments (9)
@wumail 你好,请问如果我想实现 : 递增模式,节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。应该怎么实现?
from logicflow.
@wumail 你好,请问如果我想实现 : 递增模式,节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。应该怎么实现?
目前看没有什么太好的实现方法,堆叠模式这部分代码里的限制比较多,理论上节点取消选中后是否恢复层级跟是何种堆叠模式没有关系,所以目前来说要实现你说的这种效果比较麻烦,有一个比较hack的方法:
1、事先记录好各节点各边的原始层级
2、通过
lf.graphModel.clearSelectElements = function(){
+ const zIndex = .... //获取元素的原始 层级
this.selectElements.forEach(element => {
element?.setSelected(false);
+ element.setZIndex(zIndex);
});
this.selectElements.clear();
/**
* 如果堆叠模式为默认模式,则将置顶元素重新恢复原有层级
*/
if (this.overlapMode === OverlapMode.DEFAULT) {
this.topElement?.setZIndex();
}
}
覆盖原本的clearSelectElements(clearSelectElements方法会在每次选中元素前调用),+号标记行是在原clearSelectElements方法上新增的
from logicflow.
@wumail 你好,请问如果我想实现 : 递增模式,节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。应该怎么实现?
目前看没有什么太好的实现方法,堆叠模式这部分代码里的限制比较多,理论上节点取消选中后是否恢复层级跟是何种堆叠模式没有关系,所以目前来说要实现你说的这种效果比较麻烦,有一个比较hack的方法: 1、事先记录好各节点各边的原始层级 2、通过
lf.graphModel.clearSelectElements = function(){ + const zIndex = .... //获取元素的原始 层级 this.selectElements.forEach(element => { element?.setSelected(false); + element.setZIndex(zIndex); }); this.selectElements.clear(); /** * 如果堆叠模式为默认模式,则将置顶元素重新恢复原有层级 */ if (this.overlapMode === OverlapMode.DEFAULT) { this.topElement?.setZIndex(); } }覆盖原本的clearSelectElements(clearSelectElements方法会在每次选中元素前调用),+号标记行是在原clearSelectElements方法上新增的
@wumail
我使用你修复后的,发现每次选中时置顶(toFront)会记录在history中,按照我这边的需求,应该是递增模式,选中、取消选中按照节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。但是这个过程不记录在history中,跟文档中的默认模式有点相似,唯一的区别就是会存储zIndex。使用之前的版本,我大致的代码是这么实现这个过程的,比较粗暴...
if (model.BaseType == "node") {
if (model.isSelected && model._zIndex == undefined) {
model._zIndex = model.zIndex;
var element1 = $(This.rootEl).parents(".lf-node").eq(0);
var element2 = $(This.rootEl).parents(".lf-base").eq(0).find(".lf-node:last").eq(0);
model._zIndex_1_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element1);
model._zIndex_2_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element2);
element1.insertAfter(element2);
element2.insertBefore($(This.rootEl).parents(".lf-base").find(".lf-node").eq(model._zIndex_1_Index));
}
else if (!model.isSelected && model._zIndex != undefined) {
model._zIndex = undefined;
model._zIndex_1_Index = undefined;
model._zIndex_2_Index = undefined;
}
}
from logicflow.
@wumail 你好,请问如果我想实现 : 递增模式,节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。应该怎么实现?
目前看没有什么太好的实现方法,堆叠模式这部分代码里的限制比较多,理论上节点取消选中后是否恢复层级跟是何种堆叠模式没有关系,所以目前来说要实现你说的这种效果比较麻烦,有一个比较hack的方法: 1、事先记录好各节点各边的原始层级 2、通过
lf.graphModel.clearSelectElements = function(){ + const zIndex = .... //获取元素的原始 层级 this.selectElements.forEach(element => { element?.setSelected(false); + element.setZIndex(zIndex); }); this.selectElements.clear(); /** * 如果堆叠模式为默认模式,则将置顶元素重新恢复原有层级 */ if (this.overlapMode === OverlapMode.DEFAULT) { this.topElement?.setZIndex(); } }覆盖原本的clearSelectElements(clearSelectElements方法会在每次选中元素前调用),+号标记行是在原clearSelectElements方法上新增的
@wumail 我使用你修复后的,发现每次选中时置顶(toFront)会记录在history中,按照我这边的需求,应该是递增模式,选中、取消选中按照节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。但是这个过程不记录在history中,跟文档中的默认模式有点相似,唯一的区别就是会存储zIndex。使用之前的版本,我大致的代码是这么实现这个过程的,比较粗暴...
if (model.BaseType == "node") { if (model.isSelected && model._zIndex == undefined) { model._zIndex = model.zIndex; var element1 = $(This.rootEl).parents(".lf-node").eq(0); var element2 = $(This.rootEl).parents(".lf-base").eq(0).find(".lf-node:last").eq(0); model._zIndex_1_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element1); model._zIndex_2_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element2); element1.insertAfter(element2); element2.insertBefore($(This.rootEl).parents(".lf-base").find(".lf-node").eq(model._zIndex_1_Index)); } else if (!model.isSelected && model._zIndex != undefined) { model._zIndex = undefined; model._zIndex_1_Index = undefined; model._zIndex_2_Index = undefined; } }
「修复后的」,修复是指「overlapMode设置为1时,选中节点无法置顶」这个吗?
from logicflow.
@wumail 你好,请问如果我想实现 : 递增模式,节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。应该怎么实现?
目前看没有什么太好的实现方法,堆叠模式这部分代码里的限制比较多,理论上节点取消选中后是否恢复层级跟是何种堆叠模式没有关系,所以目前来说要实现你说的这种效果比较麻烦,有一个比较hack的方法: 1、事先记录好各节点各边的原始层级 2、通过
lf.graphModel.clearSelectElements = function(){ + const zIndex = .... //获取元素的原始 层级 this.selectElements.forEach(element => { element?.setSelected(false); + element.setZIndex(zIndex); }); this.selectElements.clear(); /** * 如果堆叠模式为默认模式,则将置顶元素重新恢复原有层级 */ if (this.overlapMode === OverlapMode.DEFAULT) { this.topElement?.setZIndex(); } }覆盖原本的clearSelectElements(clearSelectElements方法会在每次选中元素前调用),+号标记行是在原clearSelectElements方法上新增的
@wumail 我使用你修复后的,发现每次选中时置顶(toFront)会记录在history中,按照我这边的需求,应该是递增模式,选中、取消选中按照节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。但是这个过程不记录在history中,跟文档中的默认模式有点相似,唯一的区别就是会存储zIndex。使用之前的版本,我大致的代码是这么实现这个过程的,比较粗暴...
if (model.BaseType == "node") { if (model.isSelected && model._zIndex == undefined) { model._zIndex = model.zIndex; var element1 = $(This.rootEl).parents(".lf-node").eq(0); var element2 = $(This.rootEl).parents(".lf-base").eq(0).find(".lf-node:last").eq(0); model._zIndex_1_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element1); model._zIndex_2_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element2); element1.insertAfter(element2); element2.insertBefore($(This.rootEl).parents(".lf-base").find(".lf-node").eq(model._zIndex_1_Index)); } else if (!model.isSelected && model._zIndex != undefined) { model._zIndex = undefined; model._zIndex_1_Index = undefined; model._zIndex_2_Index = undefined; } }「修复后的」,修复是指「overlapMode设置为1时,选中节点无法置顶」这个吗?
对,使用的是你这一版签入的代码。
from logicflow.
@wumail 你好,请问如果我想实现 : 递增模式,节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。应该怎么实现?
目前看没有什么太好的实现方法,堆叠模式这部分代码里的限制比较多,理论上节点取消选中后是否恢复层级跟是何种堆叠模式没有关系,所以目前来说要实现你说的这种效果比较麻烦,有一个比较hack的方法: 1、事先记录好各节点各边的原始层级 2、通过
lf.graphModel.clearSelectElements = function(){ + const zIndex = .... //获取元素的原始 层级 this.selectElements.forEach(element => { element?.setSelected(false); + element.setZIndex(zIndex); }); this.selectElements.clear(); /** * 如果堆叠模式为默认模式,则将置顶元素重新恢复原有层级 */ if (this.overlapMode === OverlapMode.DEFAULT) { this.topElement?.setZIndex(); } }覆盖原本的clearSelectElements(clearSelectElements方法会在每次选中元素前调用),+号标记行是在原clearSelectElements方法上新增的
@wumail 我使用你修复后的,发现每次选中时置顶(toFront)会记录在history中,按照我这边的需求,应该是递增模式,选中、取消选中按照节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。但是这个过程不记录在history中,跟文档中的默认模式有点相似,唯一的区别就是会存储zIndex。使用之前的版本,我大致的代码是这么实现这个过程的,比较粗暴...
if (model.BaseType == "node") { if (model.isSelected && model._zIndex == undefined) { model._zIndex = model.zIndex; var element1 = $(This.rootEl).parents(".lf-node").eq(0); var element2 = $(This.rootEl).parents(".lf-base").eq(0).find(".lf-node:last").eq(0); model._zIndex_1_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element1); model._zIndex_2_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element2); element1.insertAfter(element2); element2.insertBefore($(This.rootEl).parents(".lf-base").find(".lf-node").eq(model._zIndex_1_Index)); } else if (!model.isSelected && model._zIndex != undefined) { model._zIndex = undefined; model._zIndex_1_Index = undefined; model._zIndex_2_Index = undefined; } }「修复后的」,修复是指「overlapMode设置为1时,选中节点无法置顶」这个吗?
对,使用的是你这一版签入的代码。
我有点没太理解,提出这个问题时应该还没有发布新版本才是,「这一版签入的代码」是什么代码🧐
from logicflow.
@wumail 你好,请问如果我想实现 : 递增模式,节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。应该怎么实现?
目前看没有什么太好的实现方法,堆叠模式这部分代码里的限制比较多,理论上节点取消选中后是否恢复层级跟是何种堆叠模式没有关系,所以目前来说要实现你说的这种效果比较麻烦,有一个比较hack的方法: 1、事先记录好各节点各边的原始层级 2、通过
lf.graphModel.clearSelectElements = function(){ + const zIndex = .... //获取元素的原始 层级 this.selectElements.forEach(element => { element?.setSelected(false); + element.setZIndex(zIndex); }); this.selectElements.clear(); /** * 如果堆叠模式为默认模式,则将置顶元素重新恢复原有层级 */ if (this.overlapMode === OverlapMode.DEFAULT) { this.topElement?.setZIndex(); } }覆盖原本的clearSelectElements(clearSelectElements方法会在每次选中元素前调用),+号标记行是在原clearSelectElements方法上新增的
@wumail 我使用你修复后的,发现每次选中时置顶(toFront)会记录在history中,按照我这边的需求,应该是递增模式,选中、取消选中按照节点和边被选中,会被显示在最上面。当取消选中后,元素会恢复之前的层级。但是这个过程不记录在history中,跟文档中的默认模式有点相似,唯一的区别就是会存储zIndex。使用之前的版本,我大致的代码是这么实现这个过程的,比较粗暴...
if (model.BaseType == "node") { if (model.isSelected && model._zIndex == undefined) { model._zIndex = model.zIndex; var element1 = $(This.rootEl).parents(".lf-node").eq(0); var element2 = $(This.rootEl).parents(".lf-base").eq(0).find(".lf-node:last").eq(0); model._zIndex_1_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element1); model._zIndex_2_Index = $(This.rootEl).parents(".lf-base").find(".lf-node").index(element2); element1.insertAfter(element2); element2.insertBefore($(This.rootEl).parents(".lf-base").find(".lf-node").eq(model._zIndex_1_Index)); } else if (!model.isSelected && model._zIndex != undefined) { model._zIndex = undefined; model._zIndex_1_Index = undefined; model._zIndex_2_Index = undefined; } }「修复后的」,修复是指「overlapMode设置为1时,选中节点无法置顶」这个吗?
对,使用的是你这一版签入的代码。
我有点没太理解,提出这个问题时应该还没有发布新版本才是,「这一版签入的代码」是什么代码🧐
不是合并代码了嘛?我不是能下载下来编译嘛....
from logicflow.
明白了,我后续跟进下这个问题,近期有些忙
from logicflow.
明白了,我后续跟进下这个问题,近期有些忙
3Q
from logicflow.
Related Issues (20)
- [Bug Report]: 节点显示非指定坐标 HOT 2
- [锚点]: 锚点连线后 锚点位置发生变化 连线却没跟着锚点变化 HOT 1
- [Bug Report]: InsertNodeInPolyline扩展插件个性化配置设置不生效 HOT 2
- [Bug Report]: 分组节点,折叠后,文本位置问题
- [Bug Report]: MiniMap性能优化 HOT 2
- [Bug Report]: 快捷键冲突 HOT 1
- [Feature]: zoom方法放大缩小怎么获取百分比?
- [Bug Report]: 节点内部input和外部快捷键冲突 删除 赋值 粘贴 HOT 2
- [Bug Report]: 最新Chrome浏览器在拖拽节点到画布后无法再次选中该节点进行拖拽 HOT 1
- [Bug Report]: 最新Chrome浏览器在拖拽节点到画布后无法再次选中该节点进行拖拽 HOT 2
- [Feature]: 布局排列方式
- [Feature]: 边edge的样式设置目前好像没有,只有自定义边
- [Bug Report]: 连线命名为纯数字时解析报错
- [Discussion]: 框选插件事件监听问题 HOT 1
- [Bug Report]: 分组节点默认折叠后,初始渲染分组节点位置混乱
- [Bug Report]: 节点面板拖动失效并报错 HOT 2
- [Feature]: 增加anchor:dragend事件中, 对drag endpoint 是否是在另一个anchor上的判断
- [Feature]: 关于自定义拖拽面板,有对应的文档或者说参考示例吗,不知道如何将自己写的面板和画布数据进行连通,谢谢 HOT 1
- [Bug Report]: 当触发框选事件后,或者反复移动画布中的节点,或者多次放大缩小画布之后,画布鼠标滚轮的缩小放大变成全屏响应,外面拖拽面板的滚动条都失去响应 HOT 1
- [Feature]: 拖动画布,为什么画布没有动,只有节点在动。应该要和小地图中移动的效果一样,背景带着节点动,而不是只移动节点,看起来很奇怪
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logicflow.