@sepveneto/dao 0.1.5 → 0.1.7
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.
- package/README.md +2 -0
- package/dist/dao.cjs +1 -1
- package/dist/dao.cjs.map +1 -1
- package/dist/dao.js +53 -43
- package/dist/dao.js.map +1 -1
- package/dist/events/FederatedEvent.d.ts +2 -1
- package/dist/main.d.ts +1 -0
- package/dist/maths/index.d.ts +1 -1
- package/dist/scene/ViewContainer.d.ts +3 -1
- package/dist/scene/container/Container.d.ts +1 -0
- package/dist/scene/graphics/Graphics.d.ts +5 -2
- package/dist/system/EventSystem.d.ts +9 -6
- package/package.json +1 -1
package/dist/dao.js
CHANGED
|
@@ -65,7 +65,7 @@ var Matrix = class n {
|
|
|
65
65
|
j == null ? this.x = this.y = n : (this.x = n, this.y = j);
|
|
66
66
|
}
|
|
67
67
|
copyFrom(n) {
|
|
68
|
-
this.set(n.x, n.y);
|
|
68
|
+
return this.set(n.x, n.y), this;
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
function nextPow2(n) {
|
|
@@ -73,7 +73,7 @@ function nextPow2(n) {
|
|
|
73
73
|
}
|
|
74
74
|
var FederatedEvent = class {
|
|
75
75
|
constructor(n) {
|
|
76
|
-
this.system = n;
|
|
76
|
+
this.global = new Vector2(), this.screen = new Vector2(), this.system = n;
|
|
77
77
|
}
|
|
78
78
|
getLocalPosition(n, j) {
|
|
79
79
|
return n.worldTransform.applyInverse(j || this.global);
|
|
@@ -83,7 +83,10 @@ var FederatedEvent = class {
|
|
|
83
83
|
}
|
|
84
84
|
}, _EventSystem, PROPAGATION_LIMIT = 2048, EventSystem = class {
|
|
85
85
|
constructor(n) {
|
|
86
|
-
this.domElement = null, this.rootTarget = null, this.resolution = 1, this._allInteractiveElements = [], this._hitElements = [], this._isPointerMoveEvent = !1, this.mappingState = { trackingData: {} }, this.renderer = n, this.resolution = n.resolution, this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerOverOut = this._onPointerOverOut.bind(this), this.init();
|
|
86
|
+
this.domElement = null, this.rootTarget = null, this.resolution = 1, this._allInteractiveElements = [], this._hitElements = [], this._isPointerMoveEvent = !1, this.mappingState = { trackingData: {} }, this.renderer = n, this.resolution = n.resolution, this._rootPointerEvent = new FederatedEvent(null), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerOverOut = this._onPointerOverOut.bind(this), this.init();
|
|
87
|
+
}
|
|
88
|
+
get pointer() {
|
|
89
|
+
return this._rootPointerEvent;
|
|
87
90
|
}
|
|
88
91
|
trackingData(n) {
|
|
89
92
|
return this.mappingState.trackingData[n] || (this.mappingState.trackingData[n] = {
|
|
@@ -136,76 +139,77 @@ var FederatedEvent = class {
|
|
|
136
139
|
var j;
|
|
137
140
|
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
138
141
|
this._isPointerMoveEvent = !0, this._allInteractiveElements.length = 0, this._hitElements.length = 0;
|
|
139
|
-
let M = this.
|
|
142
|
+
let M = this._bootstrapEvent(this._rootPointerEvent, n), N = this.createPointEvent(M);
|
|
140
143
|
this._isPointerMoveEvent = !1;
|
|
141
|
-
let
|
|
142
|
-
if (((j =
|
|
143
|
-
let
|
|
144
|
-
this.dispatchEvent(
|
|
145
|
-
let
|
|
146
|
-
if (!
|
|
147
|
-
let
|
|
148
|
-
for (;
|
|
144
|
+
let P = this.trackingData(n.pointerId), F = findMountedTarget(P.overTargets);
|
|
145
|
+
if (((j = P.overTargets) == null ? void 0 : j.length) > 0 && F !== N.target) {
|
|
146
|
+
let n = this.createPointEvent(M, "pointerout", F);
|
|
147
|
+
this.dispatchEvent(n, "pointerout");
|
|
148
|
+
let j = N.composedPath();
|
|
149
|
+
if (!j.includes(F)) {
|
|
150
|
+
let n = this.createPointEvent(M, "pointerleave", F);
|
|
151
|
+
for (; n.target && !j.includes(n.target);) n.currentTarget = n.target, this._notifyTarget(n), n.target = n.target.parent;
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
|
-
if (
|
|
152
|
-
let n = "pointerover", j = this.clonePointEvent(
|
|
154
|
+
if (F !== N.target) {
|
|
155
|
+
let n = "pointerover", j = this.clonePointEvent(N, n);
|
|
153
156
|
this.dispatchEvent(j, n);
|
|
154
|
-
let
|
|
155
|
-
for (;
|
|
156
|
-
if (!
|
|
157
|
-
let n = this.clonePointEvent(
|
|
158
|
-
for (; n.target && n.target !==
|
|
157
|
+
let M = F == null ? void 0 : F.parent;
|
|
158
|
+
for (; M && M !== this.rootTarget.parent && M !== N.target;) M = M.parent;
|
|
159
|
+
if (!M || M === this.rootTarget.parent) {
|
|
160
|
+
let n = this.clonePointEvent(N, "pointerenter");
|
|
161
|
+
for (; n.target && n.target !== F && n.target !== this.rootTarget.parent;) n.currentTarget = n.target, this._notifyTarget(n), n.target = n.target.parent;
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
|
-
this.dispatchEvent(
|
|
162
|
-
let
|
|
163
|
-
for (let n =
|
|
164
|
-
this._allInteractiveElements.length = 0, this._hitElements.length = 0,
|
|
164
|
+
this.dispatchEvent(N, "pointermove");
|
|
165
|
+
let I = this._allInteractiveElements;
|
|
166
|
+
for (let n = I.length - 1; n >= 0; --n) N.currentTarget = I[n], this._notifyTarget(N, "globalpointermove");
|
|
167
|
+
this._allInteractiveElements.length = 0, this._hitElements.length = 0, P.overTargets = N.composedPath();
|
|
165
168
|
}
|
|
166
169
|
_onPointerDown(n) {
|
|
167
170
|
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
168
|
-
let j = this.
|
|
169
|
-
this.dispatchEvent(
|
|
170
|
-
let
|
|
171
|
-
|
|
171
|
+
let j = this._bootstrapEvent(this._rootPointerEvent, n), M = this.createPointEvent(j);
|
|
172
|
+
this.dispatchEvent(M, "pointerdown");
|
|
173
|
+
let N = this.trackingData(n.pointerId);
|
|
174
|
+
N.pressTargetsByButton[n.button] = M.composedPath();
|
|
172
175
|
}
|
|
173
176
|
_onPointerOverOut(n) {
|
|
174
177
|
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
175
|
-
let j = this.
|
|
176
|
-
this.dispatchEvent(
|
|
178
|
+
let j = this._bootstrapEvent(this._rootPointerEvent, n), M = this.createPointEvent(j);
|
|
179
|
+
this.dispatchEvent(M, "pointerout");
|
|
177
180
|
}
|
|
178
181
|
_onPointerUp(n) {
|
|
179
182
|
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
180
183
|
let j = n.target;
|
|
181
184
|
n.composedPath && n.composedPath().length > 1 && (j = n.composedPath()[0]);
|
|
182
|
-
let M = j === this.domElement ? "" : "outside",
|
|
183
|
-
this.dispatchEvent(
|
|
185
|
+
let M = this._bootstrapEvent(this._rootPointerEvent, n), N = j === this.domElement ? "" : "outside", P = this.createPointEvent(M);
|
|
186
|
+
this.dispatchEvent(P, `pointerup${N}`);
|
|
184
187
|
}
|
|
185
188
|
_isInteractive(n) {
|
|
186
189
|
return n === "static";
|
|
187
190
|
}
|
|
191
|
+
_bootstrapEvent(n, j) {
|
|
192
|
+
return n.nativeEvent = j, this.mapPositionToPoint(n.screen, j.clientX, j.clientY), n.global.copyFrom(n.screen), j.type === "pointerleave" ? n.type = "pointerout" : n.type = j.type, n;
|
|
193
|
+
}
|
|
188
194
|
createPointEvent(n, j, M) {
|
|
189
195
|
var N;
|
|
190
|
-
let P = this
|
|
191
|
-
n.
|
|
192
|
-
let F = new FederatedEvent(this);
|
|
193
|
-
return F.type = j, F.nativeEvent = n, F.target = (N = M == null ? this.hitTest(P.x, P.y) : M) == null ? this._hitElements[0] : N, F.global = P, F;
|
|
196
|
+
let P = new FederatedEvent(this);
|
|
197
|
+
return P.global.copyFrom(n.global), P.screen.copyFrom(n.screen), P.nativeEvent = n.nativeEvent, P.target = (N = M == null ? this.hitTest(P.global.x, P.global.y) : M) == null ? this._hitElements[0] : N, j && (P.type = j), P;
|
|
194
198
|
}
|
|
195
199
|
clonePointEvent(n, j) {
|
|
196
200
|
let M = new FederatedEvent(this);
|
|
197
201
|
return M.nativeEvent = n.nativeEvent, M.global = n.global, M.type = j == null ? n.type : j, M.path = n.composedPath().slice(), M.target = n.target, M;
|
|
198
202
|
}
|
|
199
|
-
mapPositionToPoint(n, j) {
|
|
200
|
-
let
|
|
203
|
+
mapPositionToPoint(n, j, M) {
|
|
204
|
+
let N = this.domElement, P = N.isConnected ? N.getBoundingClientRect() : {
|
|
201
205
|
x: 0,
|
|
202
206
|
y: 0,
|
|
203
|
-
width:
|
|
204
|
-
height:
|
|
207
|
+
width: N.width,
|
|
208
|
+
height: N.height,
|
|
205
209
|
left: 0,
|
|
206
210
|
top: 0
|
|
207
|
-
},
|
|
208
|
-
return
|
|
211
|
+
}, F = 1 / this.resolution;
|
|
212
|
+
return n.x = (j - P.left) * (N.width / P.width) * F, n.y = (M - P.top) * (N.height / P.height) * F, n;
|
|
209
213
|
}
|
|
210
214
|
hitTest(n, j) {
|
|
211
215
|
let M = this._isPointerMoveEvent, N = this[M ? "hitTestMoveRecursive" : "hitTestRecursive"](this.rootTarget, this.rootTarget.eventMode, new Vector2(n, j));
|
|
@@ -233,6 +237,7 @@ var FederatedEvent = class {
|
|
|
233
237
|
}
|
|
234
238
|
}
|
|
235
239
|
hitTestRecursive(n, j, M) {
|
|
240
|
+
if (this._interactivePrune(n)) return;
|
|
236
241
|
let N = n.children;
|
|
237
242
|
for (let P = N.length - 1; P >= 0; P--) {
|
|
238
243
|
let F = N[P], I = this.hitTestRecursive(F, this._isInteractive(j) ? j : F.eventMode, M);
|
|
@@ -1298,7 +1303,12 @@ function toStrokeStyle(n, j) {
|
|
|
1298
1303
|
}
|
|
1299
1304
|
var Graphics = class extends ViewContainer {
|
|
1300
1305
|
constructor(n) {
|
|
1301
|
-
|
|
1306
|
+
n instanceof GraphicsContext && (n = { context: n });
|
|
1307
|
+
let { context: j, ...M } = n || {};
|
|
1308
|
+
super({
|
|
1309
|
+
label: "Graphics",
|
|
1310
|
+
...M
|
|
1311
|
+
}), this.renderPipeId = "graphics", j ? this.context = j : this.context = new GraphicsContext();
|
|
1302
1312
|
}
|
|
1303
1313
|
setStrokeStyle(...n) {
|
|
1304
1314
|
return this._callContextMethod("setStrokeStyle", n);
|
|
@@ -2447,6 +2457,6 @@ var AssetsClass = class {
|
|
|
2447
2457
|
}
|
|
2448
2458
|
};
|
|
2449
2459
|
const Assets = new AssetsClass();
|
|
2450
|
-
export { Application, Assets, AssetsClass, CanvasRenderer, Container, Graphics, GraphicsContext, GraphicsPipe, Matrix, PI_2, Rectangle, RenderGroup, Sprite, Text, TextPipe, Texture, Ticker, TickerListener, UPDATE_BLEND, UPDATE_COLOR, UPDATE_TRANSFORM, UPDATE_VISIBLE, Vector2, ViewContainer, buildShapePath, nextPow2 };
|
|
2460
|
+
export { Application, Assets, AssetsClass, CanvasRenderer, Container, Graphics, GraphicsContext, GraphicsPipe, Matrix, PI_2, Rectangle, RenderGroup, RenderTexture, Sprite, Text, TextPipe, Texture, Ticker, TickerListener, UPDATE_BLEND, UPDATE_COLOR, UPDATE_TRANSFORM, UPDATE_VISIBLE, Vector2, ViewContainer, buildShapePath, nextPow2 };
|
|
2451
2461
|
|
|
2452
2462
|
//# sourceMappingURL=dao.js.map
|