diff --git a/CHANGELOG.md b/CHANGELOG.md
index c4a7725ad..39acf1dbd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -634,6 +634,8 @@
* Added `MeshAttachment#newLinkedMesh()`, creates a linked mesh linkted to either the original mesh, or the parent of the original mesh.
* Added IK softness.
* Added `AssetManager.setRawDataURI(path, data)`. Allows to embed data URIs for skeletons, atlases and atlas page images directly in the HTML/JS without needing to load it from a separate file.
+ * Added `AssetManager.loadAll()` to allow Promise/async/await based waiting for completion of asset load. See the `spine-canvas` examples.
+ * Added `Skeleton.getBoundRect()` helper method to calculate the bouding rectangle of the current pose, returning the result as `{ x, y, width, height }`. Note that this method will create temporary objects which can add to garbage collection pressure.
### WebGL backend
* `Input` can now take a partially defined implementation of `InputListener`.
diff --git a/spine-ts/index.html b/spine-ts/index.html
index 1d8787794..205e9416e 100644
--- a/spine-ts/index.html
+++ b/spine-ts/index.html
@@ -14,6 +14,7 @@
Canvas
Player
diff --git a/spine-ts/spine-canvas/example/index.html b/spine-ts/spine-canvas/example/index.html
index a6b420988..52c537d25 100644
--- a/spine-ts/spine-canvas/example/index.html
+++ b/spine-ts/spine-canvas/example/index.html
@@ -1,181 +1,86 @@
+
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/spine-ts/spine-canvas/example/mouse-click.html b/spine-ts/spine-canvas/example/mouse-click.html
new file mode 100644
index 000000000..a8a16f36c
--- /dev/null
+++ b/spine-ts/spine-canvas/example/mouse-click.html
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spine-ts/spine-core/src/AssetManagerBase.ts b/spine-ts/spine-core/src/AssetManagerBase.ts
index deb8d6fb5..607ac9a36 100644
--- a/spine-ts/spine-core/src/AssetManagerBase.ts
+++ b/spine-ts/spine-core/src/AssetManagerBase.ts
@@ -65,6 +65,21 @@ export class AssetManagerBase implements Disposable {
if (callback) callback(path, message);
}
+ loadAll () {
+ let promise = new Promise((resolve: (assetManager: AssetManagerBase) => void, reject: (errors: StringMap) => void) => {
+ let check = () => {
+ if (this.isLoadingComplete()) {
+ if (this.hasErrors()) reject(this.errors);
+ else resolve(this);
+ return;
+ }
+ requestAnimationFrame(check);
+ }
+ requestAnimationFrame(check);
+ });
+ return promise;
+ }
+
setRawDataURI (path: string, data: string) {
this.downloader.rawDataUris[this.pathPrefix + path] = data;
}
diff --git a/spine-ts/spine-core/src/Skeleton.ts b/spine-ts/spine-core/src/Skeleton.ts
index 3be52c8f2..eca98def0 100644
--- a/spine-ts/spine-core/src/Skeleton.ts
+++ b/spine-ts/spine-core/src/Skeleton.ts
@@ -585,6 +585,15 @@ export class Skeleton {
return null;
}
+ /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`.
+ * Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
+ getBoundsRect () {
+ let offset = new Vector2();
+ let size = new Vector2();
+ this.getBounds(offset, size);
+ return { x: offset.x, y: offset.y, width: size.x, height: size.y };
+ }
+
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
* @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
* @param size An output value, the width and height of the AABB.