@esotericsoftware/spine-webgl 4.2.112 → 4.2.113
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/dist/SceneRenderer.d.ts +3 -0
- package/dist/SceneRenderer.js +17 -2
- package/dist/esm/spine-webgl.min.mjs +3 -3
- package/dist/esm/spine-webgl.mjs +20 -1
- package/dist/esm/spine-webgl.mjs.map +2 -2
- package/dist/iife/spine-webgl.js +20 -1
- package/dist/iife/spine-webgl.js.map +2 -2
- package/dist/iife/spine-webgl.min.js +2 -2
- package/package.json +2 -2
package/dist/iife/spine-webgl.js
CHANGED
|
@@ -5863,6 +5863,11 @@ var spine = (() => {
|
|
|
5863
5863
|
try {
|
|
5864
5864
|
const atlas = this.createTextureAtlas(path, atlasText);
|
|
5865
5865
|
let toLoad = atlas.pages.length, abort = false;
|
|
5866
|
+
if (toLoad === 0) {
|
|
5867
|
+
this.success(success, path, atlas);
|
|
5868
|
+
resolve(atlas);
|
|
5869
|
+
return;
|
|
5870
|
+
}
|
|
5866
5871
|
for (let page of atlas.pages) {
|
|
5867
5872
|
this.loadTexture(
|
|
5868
5873
|
!fileAlias ? parent + page.name : fileAlias[page.name],
|
|
@@ -13537,6 +13542,8 @@ void main () {
|
|
|
13537
13542
|
shapes;
|
|
13538
13543
|
shapesShader;
|
|
13539
13544
|
activeRenderer = null;
|
|
13545
|
+
maxCanvasWidth = 0;
|
|
13546
|
+
maxCanvasHeight = 0;
|
|
13540
13547
|
skeletonRenderer;
|
|
13541
13548
|
skeletonDebugRenderer;
|
|
13542
13549
|
constructor(canvas, context, twoColorTint = true) {
|
|
@@ -13910,7 +13917,7 @@ void main () {
|
|
|
13910
13917
|
}
|
|
13911
13918
|
resize(resizeMode) {
|
|
13912
13919
|
let canvas = this.canvas;
|
|
13913
|
-
var dpr =
|
|
13920
|
+
var dpr = this.getSafeDevicePixelRatio(canvas.clientWidth, canvas.clientHeight);
|
|
13914
13921
|
var w = Math.round(canvas.clientWidth * dpr);
|
|
13915
13922
|
var h = Math.round(canvas.clientHeight * dpr);
|
|
13916
13923
|
if (canvas.width != w || canvas.height != h) {
|
|
@@ -13930,6 +13937,18 @@ void main () {
|
|
|
13930
13937
|
}
|
|
13931
13938
|
this.camera.update();
|
|
13932
13939
|
}
|
|
13940
|
+
getSafeDevicePixelRatio(cssWidth, cssHeight) {
|
|
13941
|
+
const dpr = window.devicePixelRatio || 1;
|
|
13942
|
+
if (cssWidth <= 0 || cssHeight <= 0) return dpr;
|
|
13943
|
+
if (this.maxCanvasWidth === 0 || this.maxCanvasHeight === 0) {
|
|
13944
|
+
const gl = this.context.gl;
|
|
13945
|
+
const maxRenderbufferSize = gl.getParameter(gl.MAX_RENDERBUFFER_SIZE);
|
|
13946
|
+
const maxViewportDims = gl.getParameter(gl.MAX_VIEWPORT_DIMS);
|
|
13947
|
+
this.maxCanvasWidth = Math.min(maxRenderbufferSize, maxViewportDims[0]);
|
|
13948
|
+
this.maxCanvasHeight = Math.min(maxRenderbufferSize, maxViewportDims[1]);
|
|
13949
|
+
}
|
|
13950
|
+
return Math.min(dpr, this.maxCanvasWidth / cssWidth, this.maxCanvasHeight / cssHeight);
|
|
13951
|
+
}
|
|
13933
13952
|
enableRenderer(renderer) {
|
|
13934
13953
|
if (this.activeRenderer === renderer) return;
|
|
13935
13954
|
this.end();
|