@flashist/flibs 0.0.103 → 0.0.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseObject } from "@flashist/fcore";
|
|
2
|
-
import { DisplayObject } from "../../index";
|
|
2
|
+
import { DisplayObject, Point } from "../../index";
|
|
3
3
|
export declare class DragHelper extends BaseObject {
|
|
4
4
|
private _view;
|
|
5
5
|
private viewEventListenerHelper;
|
|
@@ -10,6 +10,9 @@ export declare class DragHelper extends BaseObject {
|
|
|
10
10
|
lastDragGlobalY: number;
|
|
11
11
|
changeDragGlobalX: number;
|
|
12
12
|
changeDragGlobalY: number;
|
|
13
|
+
protected startDragLocalPoint: Point;
|
|
14
|
+
protected lastDragLocalPoint: Point;
|
|
15
|
+
protected startDragViewShiftPoint: Point;
|
|
13
16
|
dragUpdateDelay: number;
|
|
14
17
|
protected dragStartTime: number;
|
|
15
18
|
constructor();
|
|
@@ -32,4 +35,12 @@ export declare class DragHelper extends BaseObject {
|
|
|
32
35
|
get view(): DisplayObject;
|
|
33
36
|
set view(value: DisplayObject);
|
|
34
37
|
private checkIsNeedUpdateDrag;
|
|
38
|
+
get startDragLocalX(): number;
|
|
39
|
+
get startDragLocalY(): number;
|
|
40
|
+
get lastDragLocalX(): number;
|
|
41
|
+
get lastDragLocalY(): number;
|
|
42
|
+
get changeDragLocalX(): number;
|
|
43
|
+
get changeDragLocalY(): number;
|
|
44
|
+
get lastDragWithShiftLocalX(): number;
|
|
45
|
+
get lastDragWidthShiftLocalY(): number;
|
|
35
46
|
}
|
|
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
};
|
|
15
15
|
})();
|
|
16
16
|
import { BaseObject, EventListenerHelper } from "@flashist/fcore";
|
|
17
|
-
import { FApp, InteractiveEvent } from "../../index";
|
|
17
|
+
import { FApp, InteractiveEvent, Point } from "../../index";
|
|
18
18
|
import { DragHelperEvent } from "./DragHelperEvent";
|
|
19
19
|
var DragHelper = /** @class */ (function (_super) {
|
|
20
20
|
__extends(DragHelper, _super);
|
|
@@ -26,6 +26,10 @@ var DragHelper = /** @class */ (function (_super) {
|
|
|
26
26
|
_this.lastDragGlobalY = 0;
|
|
27
27
|
_this.changeDragGlobalX = 0;
|
|
28
28
|
_this.changeDragGlobalY = 0;
|
|
29
|
+
_this.startDragLocalPoint = new Point();
|
|
30
|
+
_this.lastDragLocalPoint = new Point();
|
|
31
|
+
// Shift is needed to calculate correct final position of the drag
|
|
32
|
+
_this.startDragViewShiftPoint = new Point();
|
|
29
33
|
// Might be useful to prevent too quick/too small drags
|
|
30
34
|
_this.dragUpdateDelay = 0;
|
|
31
35
|
_this.dragStartTime = 0;
|
|
@@ -97,8 +101,14 @@ var DragHelper = /** @class */ (function (_super) {
|
|
|
97
101
|
var globalPos = FApp.instance.getGlobalInteractionPosition();
|
|
98
102
|
this.startDragGlobalX = globalPos.x;
|
|
99
103
|
this.startDragGlobalY = globalPos.y;
|
|
104
|
+
this.view.parent.toLocal({ x: this.startDragGlobalX, y: this.startDragGlobalY }, null, this.startDragLocalPoint);
|
|
105
|
+
//
|
|
106
|
+
this.startDragViewShiftPoint.x = this.startDragGlobalX - this.view.x;
|
|
107
|
+
this.startDragViewShiftPoint.y = this.startDragGlobalY - this.view.y;
|
|
100
108
|
this.lastDragGlobalX = this.startDragGlobalX;
|
|
101
109
|
this.lastDragGlobalY = this.startDragGlobalY;
|
|
110
|
+
this.lastDragLocalPoint.x = this.startDragLocalPoint.x;
|
|
111
|
+
this.lastDragLocalPoint.y = this.startDragLocalPoint.y;
|
|
102
112
|
this.changeDragGlobalX = 0;
|
|
103
113
|
this.changeDragGlobalY = 0;
|
|
104
114
|
this.dispatchDragStartEvent();
|
|
@@ -124,6 +134,7 @@ var DragHelper = /** @class */ (function (_super) {
|
|
|
124
134
|
this.changeDragGlobalY = this.lastDragGlobalY - this.startDragGlobalY;
|
|
125
135
|
console.log("this.lastDragGlobalX:", this.lastDragGlobalX, " | this.lastDragGlobalY:", this.lastDragGlobalY);
|
|
126
136
|
console.log("this.startDragGlobalX:", this.startDragGlobalX, " | this.startDragGlobalY:", this.startDragGlobalY);
|
|
137
|
+
this.view.parent.toLocal({ x: this.lastDragGlobalX, y: this.lastDragGlobalY }, null, this.lastDragLocalPoint);
|
|
127
138
|
this.dispatchDragUpdateEvent();
|
|
128
139
|
};
|
|
129
140
|
Object.defineProperty(DragHelper.prototype, "isDragStarted", {
|
|
@@ -164,6 +175,62 @@ var DragHelper = /** @class */ (function (_super) {
|
|
|
164
175
|
}
|
|
165
176
|
return result;
|
|
166
177
|
};
|
|
178
|
+
Object.defineProperty(DragHelper.prototype, "startDragLocalX", {
|
|
179
|
+
get: function () {
|
|
180
|
+
return this.startDragLocalPoint.x;
|
|
181
|
+
},
|
|
182
|
+
enumerable: false,
|
|
183
|
+
configurable: true
|
|
184
|
+
});
|
|
185
|
+
Object.defineProperty(DragHelper.prototype, "startDragLocalY", {
|
|
186
|
+
get: function () {
|
|
187
|
+
return this.startDragLocalPoint.y;
|
|
188
|
+
},
|
|
189
|
+
enumerable: false,
|
|
190
|
+
configurable: true
|
|
191
|
+
});
|
|
192
|
+
Object.defineProperty(DragHelper.prototype, "lastDragLocalX", {
|
|
193
|
+
get: function () {
|
|
194
|
+
return this.lastDragLocalPoint.x;
|
|
195
|
+
},
|
|
196
|
+
enumerable: false,
|
|
197
|
+
configurable: true
|
|
198
|
+
});
|
|
199
|
+
Object.defineProperty(DragHelper.prototype, "lastDragLocalY", {
|
|
200
|
+
get: function () {
|
|
201
|
+
return this.lastDragLocalPoint.y;
|
|
202
|
+
},
|
|
203
|
+
enumerable: false,
|
|
204
|
+
configurable: true
|
|
205
|
+
});
|
|
206
|
+
Object.defineProperty(DragHelper.prototype, "changeDragLocalX", {
|
|
207
|
+
get: function () {
|
|
208
|
+
return this.lastDragLocalPoint.x - this.startDragLocalPoint.x;
|
|
209
|
+
},
|
|
210
|
+
enumerable: false,
|
|
211
|
+
configurable: true
|
|
212
|
+
});
|
|
213
|
+
Object.defineProperty(DragHelper.prototype, "changeDragLocalY", {
|
|
214
|
+
get: function () {
|
|
215
|
+
return this.lastDragLocalPoint.y - this.startDragLocalPoint.y;
|
|
216
|
+
},
|
|
217
|
+
enumerable: false,
|
|
218
|
+
configurable: true
|
|
219
|
+
});
|
|
220
|
+
Object.defineProperty(DragHelper.prototype, "lastDragWithShiftLocalX", {
|
|
221
|
+
get: function () {
|
|
222
|
+
return this.lastDragLocalPoint.x - this.startDragViewShiftPoint.x;
|
|
223
|
+
},
|
|
224
|
+
enumerable: false,
|
|
225
|
+
configurable: true
|
|
226
|
+
});
|
|
227
|
+
Object.defineProperty(DragHelper.prototype, "lastDragWidthShiftLocalY", {
|
|
228
|
+
get: function () {
|
|
229
|
+
return this.lastDragLocalPoint.y - this.startDragViewShiftPoint.y;
|
|
230
|
+
},
|
|
231
|
+
enumerable: false,
|
|
232
|
+
configurable: true
|
|
233
|
+
});
|
|
167
234
|
return DragHelper;
|
|
168
235
|
}(BaseObject));
|
|
169
236
|
export { DragHelper };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragHelper.js","sourceRoot":"","sources":["../../../src/other/dragHelper/DragHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DragHelper.js","sourceRoot":"","sources":["../../../src/other/dragHelper/DragHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EACY,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAC/C,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;IAAgC,8BAAU;IAwBtC;QAAA,YACI,iBAAO,SACV;QAnBM,sBAAgB,GAAW,CAAC,CAAC;QAC7B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I,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACtE,CAAC;;;OAAA;IACD,sBAAW,gDAAwB;aAAnC;YACI,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACtE,CAAC;;;OAAA;IACL,iBAAC;AAAD,CAAC,AAxPD,CAAgC,UAAU,GAwPzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragHelperEvent.js","sourceRoot":"","sources":["../../../src/other/dragHelper/DragHelperEvent.ts"],"names":[],"mappings":"AAAA;IAAA;IAIA,CAAC;IAHiB,0BAAU,
|
|
1
|
+
{"version":3,"file":"DragHelperEvent.js","sourceRoot":"","sources":["../../../src/other/dragHelper/DragHelperEvent.ts"],"names":[],"mappings":"AAAA;IAAA;IAIA,CAAC;IAHiB,0BAAU,GAAW,oCAAoC,CAAC;IAC1D,wBAAQ,GAAW,kCAAkC,CAAC;IACtD,2BAAW,GAAW,qCAAqC,CAAC;IAC9E,sBAAC;CAAA,AAJD,IAIC;SAJY,eAAe"}
|