pixi-silk 1.0.1 → 1.0.2
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/CHANGELOG.md +6 -0
- package/dist/ui/gizmo.d.ts +2 -1
- package/dist/ui/gizmo.js +25 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# pixi-silk
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#14](https://github.com/schmooky/pixi-silk/pull/14) [`2bc3024`](https://github.com/schmooky/pixi-silk/commit/2bc30243a749b18c02baeb07bc1c9a9c6120c878) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - `TransformGizmo.grab()` now ends its drag on the next release wherever it happens. Before, a drag started from a press on another object only ended when the release reached the gizmo itself, so the target kept following the pointer after the button was let go. The gizmo now listens for `pointerup`, `pointerupoutside` and `pointercancel` on the pressed object for the length of the drag, and also ends it when the window loses focus or cancels the pointer.
|
|
8
|
+
|
|
3
9
|
## 1.0.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/ui/gizmo.d.ts
CHANGED
|
@@ -169,7 +169,8 @@ export declare class TransformGizmo extends Container {
|
|
|
169
169
|
private _p;
|
|
170
170
|
/**
|
|
171
171
|
* Starts dragging from a pointer press that landed elsewhere, such as on the object itself:
|
|
172
|
-
* press an object and move it in one go. Defaults to a free move.
|
|
172
|
+
* press an object and move it in one go. Defaults to a free move. The drag ends on the next
|
|
173
|
+
* release, cancel or loss of window focus, wherever the pointer is then.
|
|
173
174
|
*/
|
|
174
175
|
grab(e: FederatedPointerEvent, handle?: GizmoHandle): void;
|
|
175
176
|
private _onDown;
|
package/dist/ui/gizmo.js
CHANGED
|
@@ -134,6 +134,7 @@ var TransformGizmo = class extends Container {
|
|
|
134
134
|
this.on("globalpointermove", this._onMove, this);
|
|
135
135
|
this.on("pointerup", this._onUp, this);
|
|
136
136
|
this.on("pointerupoutside", this._onUp, this);
|
|
137
|
+
this.on("pointercancel", this._onUp, this);
|
|
137
138
|
this.on("pointerout", () => {
|
|
138
139
|
if (!this._drag) this.state.hover.set(null);
|
|
139
140
|
});
|
|
@@ -357,10 +358,32 @@ var TransformGizmo = class extends Container {
|
|
|
357
358
|
}
|
|
358
359
|
/**
|
|
359
360
|
* Starts dragging from a pointer press that landed elsewhere, such as on the object itself:
|
|
360
|
-
* press an object and move it in one go. Defaults to a free move.
|
|
361
|
+
* press an object and move it in one go. Defaults to a free move. The drag ends on the next
|
|
362
|
+
* release, cancel or loss of window focus, wherever the pointer is then.
|
|
361
363
|
*/
|
|
362
364
|
grab(e, handle) {
|
|
365
|
+
const pressed = e.currentTarget ?? e.target;
|
|
363
366
|
this._begin(e, handle ?? (this.state.mode.value === "box" ? "box-move" : "move-free"));
|
|
367
|
+
const drag = this._drag;
|
|
368
|
+
if (!drag || drag.unlisten) return;
|
|
369
|
+
const up = (ev) => this._onUp(ev);
|
|
370
|
+
const blur = () => this._end();
|
|
371
|
+
const cancel = (ev) => {
|
|
372
|
+
if (ev.pointerId === drag.id) this._end();
|
|
373
|
+
};
|
|
374
|
+
const types = [
|
|
375
|
+
"pointerup",
|
|
376
|
+
"pointerupoutside",
|
|
377
|
+
"pointercancel"
|
|
378
|
+
];
|
|
379
|
+
if (pressed && pressed !== this) for (const type of types) pressed.on(type, up);
|
|
380
|
+
globalThis.addEventListener?.("blur", blur);
|
|
381
|
+
globalThis.addEventListener?.("pointercancel", cancel);
|
|
382
|
+
drag.unlisten = () => {
|
|
383
|
+
if (pressed && pressed !== this) for (const type of types) pressed.off(type, up);
|
|
384
|
+
globalThis.removeEventListener?.("blur", blur);
|
|
385
|
+
globalThis.removeEventListener?.("pointercancel", cancel);
|
|
386
|
+
};
|
|
364
387
|
}
|
|
365
388
|
_onDown(e) {
|
|
366
389
|
this._begin(e, null);
|
|
@@ -464,6 +487,7 @@ var TransformGizmo = class extends Container {
|
|
|
464
487
|
const drag = this._drag;
|
|
465
488
|
if (!drag) return;
|
|
466
489
|
this._drag = null;
|
|
490
|
+
drag.unlisten?.();
|
|
467
491
|
this.state.active.set(null);
|
|
468
492
|
this.state.dragging.set(false);
|
|
469
493
|
this.state.snapping.set(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixi-silk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Smooth vector graphics for PixiJS v8: analytic anti-aliased SDF primitives, squircles, arcs, polylines, dashes, OKLab gradients, glows and DPR-exact canvases, one draw call per object.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|