MCPcopy Create free account
hub / github.com/Easy-Editor/EasyEditor / checkSelect

Method checkSelect

packages/core/src/simulator/simulator.ts:337–358  ·  view source on GitHub ↗
(e: MouseEvent)

Source from the content-addressed store, hash-verified

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]

Callers

nothing calls this directly

Calls 6

isShakenFunction · 0.90
containsMethod · 0.80
hasMethod · 0.65
removeMethod · 0.45
selectMethod · 0.45
postEventMethod · 0.45

Tested by

no test coverage detected