Skip to content

Commit 84e3482

Browse files
DymoneLewisCopilot
andcommitted
Apply suggestions from code review
Co-authored-by: Copilot <[email protected]>
1 parent b978ff5 commit 84e3482

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

packages/extension/src/pool/LaneModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class LaneModel extends DynamicGroupNodeModel {
1616
// 泳道特定配置
1717
this.width = data.width || laneConfig.defaultWidth
1818
this.height = data.height || laneConfig.defaultHeight
19-
this.draggable = true // 禁止拖拽(由泳池控制
19+
this.draggable = true // 允许拖拽(实际拖拽逻辑由泳池控制
2020
this.resizable = true // 允许调整大小
2121
this.rotatable = false // 禁止旋转
2222

packages/extension/src/pool/PoolModel.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class PoolModel extends DynamicGroupNodeModel {
5555
this.updateTextPosition()
5656
this.addEventListeners()
5757
this.resizePool()
58-
this
58+
5959
}
6060

6161
// 增加监听事件
@@ -206,7 +206,9 @@ export class PoolModel extends DynamicGroupNodeModel {
206206
orderedLanes = lanes
207207
.filter((lane) => lane.id !== newLaneId)
208208
.slice()
209-
.sort((a: any, b: any) => a.x - b.x)
209+
.sort((a: any, b: any) =>
210+
this.isHorizontal ? a.y - b.y : a.x - b.x,
211+
)
210212
if (newLane) {
211213
const refId = (newLane as any).properties?.referenceLaneId
212214
const refIndex = refId
@@ -408,8 +410,10 @@ export class PoolModel extends DynamicGroupNodeModel {
408410
let initialY = this.y
409411
// 参考泳道(用于定位)
410412
const referenceLane = lanes.find((lane) => lane.id === laneData?.id)
411-
const laneWidth = referenceLane.width
412-
const laneHeight = referenceLane.height
413+
// 用于确定新泳道尺寸的参考泳道,优先使用referenceLane,其次使用现有第一个泳道,最后回退到泳池尺寸
414+
const sizeLane = referenceLane || lanes[0]
415+
const laneWidth = sizeLane?.width ?? this.width
416+
const laneHeight = sizeLane?.height ?? this.height
413417

414418
if (this.isHorizontal && ['above', 'below'].includes(position)) {
415419
if (referenceLane) {

0 commit comments

Comments
 (0)