MCPcopy Create free account
hub / github.com/alibaba/butterfly / constructor

Method constructor

plugins/panel/src/node/panel-node.js:10–52  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

8
9class PanelNode extends Node {
10 constructor(opts) {
11 super(opts);
12 this.options = opts;
13 // 是否选中状态
14 this.actived = false;
15
16 // 连线锚点
17 this.endPointN = null;
18 this.endPointE = null;
19 this.endPointS = null;
20 this.endPointW = null;
21
22 // 控制点
23 this.controlEndPointR = null;
24 this.controlEndPointNE = null;
25 this.controlEndPointSE = null;
26 this.controlEndPointSW = null;
27 this.controlEndPointNW = null;
28
29 this.content = opts.content || null;
30
31 this.width = opts.width || 36;
32 this.height = opts.height || 36;
33
34 // 旋转角度
35 this.rotatorDeg = opts.rotate || 0;
36 // 旋转前的4个控制点的位置
37 this.rotatorPosBefore = {
38 NW: {X: this.left, Y: this.top},
39 NE: {X: this.left + this.width, Y: this.top},
40 SE: {X: this.left + this.width, Y: this.top + this.height},
41 SW: {X: this.left, Y: this.top + this.height},
42 }
43 // 旋转后的4个控制点的位置
44 this.rotatorPosAfter = {
45 NW: {X: this.left, Y: this.top},
46 NE: {X: this.left + this.width, Y: this.top},
47 SE: {X: this.left + this.width, Y: this.top + this.height},
48 SW: {X: this.left, Y: this.top + this.height},
49 }
50 // 标识是那个控制点在移动
51 this.moveDirection = null;
52 }
53
54 mounted = () => {
55 this.addEndpoint({

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected