MCPcopy Create free account
hub / github.com/esengine/esengine / startDrag

Method startDrag

packages/fairygui/src/core/DragDropManager.ts:89–103  ·  view source on GitHub ↗

* Start a drag operation * 开始拖拽操作 * * @param source - Source object initiating drag | 发起拖拽的源对象 * @param icon - Icon URL for drag agent | 拖拽代理的图标 URL * @param sourceData - Data to carry during drag | 拖拽期间携带的数据 * @param touchId - Touch point ID for multi-touch | 多点触控的触摸点

(source: GObject, icon: string, sourceData?: any, touchId?: number)

Source from the content-addressed store, hash-verified

87 * @param touchId - Touch point ID for multi-touch | 多点触控的触摸点 ID
88 */
89 public startDrag(source: GObject, icon: string, sourceData?: any, touchId?: number): void {
90 if (this._agent.parent) {
91 return;
92 }
93
94 this._sourceData = sourceData;
95 this._agent.url = icon;
96
97 GRoot.inst.addChild(this._agent);
98
99 const stage = Stage.inst;
100 const pt = GRoot.inst.globalToLocal(stage.mouseX, stage.mouseY);
101 this._agent.setXY(pt.x, pt.y);
102 this._agent.startDrag(touchId);
103 }
104
105 /**
106 * Cancel current drag operation

Callers

nothing calls this directly

Calls 3

globalToLocalMethod · 0.80
setXYMethod · 0.80
addChildMethod · 0.45

Tested by

no test coverage detected