| 335 | |
| 336 | const isLeftButton = downEvent.button === 0 |
| 337 | const checkSelect = (e: MouseEvent) => { |
| 338 | doc.removeEventListener('mouseup', checkSelect, true) |
| 339 | |
| 340 | const isLeftButtonSelect = e.button === 0 |
| 341 | // 鼠标是否移动 ? - 鼠标抖动应该也需要支持选中事件,偶尔点击不能选中,磁帖块移除 shaken 检测 |
| 342 | if (!isShaken(downEvent, e) && isLeftButtonSelect) { |
| 343 | const { id } = node |
| 344 | if (isMulti && rootNode && !node.contains(rootNode) && selection.has(id)) { |
| 345 | selection.remove(id) |
| 346 | } else { |
| 347 | if (rootNode) { |
| 348 | selection.select(node.contains(rootNode) ? rootNode.id : id) |
| 349 | } |
| 350 | |
| 351 | // dirty code should refector |
| 352 | const selected = node?.componentMeta?.componentName || '' |
| 353 | this.designer.postEvent(DESIGNER_EVENT.SIMULATOR_SELECT, { |
| 354 | selected, |
| 355 | }) |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | if (isLeftButton && rootNode && !node.contains(rootNode)) { |
| 361 | let nodes: Node[] = [node] |