Skip to content

Commit

Permalink
fix: zIndex cache when selection
Browse files Browse the repository at this point in the history
  • Loading branch information
xachary committed Oct 31, 2024
1 parent 1172fd9 commit e0f6859
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Render/tools/SelectionTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class SelectionTool {

// 选择变化了
this.render.emit('selection-change', nodes)

this.selectingClear(true)

if (nodes.length > 0) {
Expand All @@ -85,7 +85,7 @@ export class SelectionTool {
)

// 记录状态
for (const node of nodes.sort((a, b) => a.zIndex() - b.zIndex())) {
for (const node of nodes) {
node.setAttrs({
nodeMousedownPos: node.position(), // 后面用于移动所选
lastOpacity: node.opacity(), // 选中时,下面会使其变透明,记录原有的透明度
Expand All @@ -95,6 +95,12 @@ export class SelectionTool {

listening: false, // 不可交互
opacity: node.opacity() * 0.8, // 设置透明度
})
}

// 提升层次
for (const node of nodes.sort((a, b) => a.zIndex() - b.zIndex())) {
node.setAttrs({
zIndex: maxZIndex // 提升层次
})
}
Expand Down

0 comments on commit e0f6859

Please sign in to comment.