mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 13:43:26 +00:00
Rebuilt for latest Spine Runtimes
This commit is contained in:
parent
1de2bb8616
commit
2ffe15109b
11 changed files with 1818 additions and 1384 deletions
2900
plugins/spine/dist/SpinePluginDebug.js
vendored
2900
plugins/spine/dist/SpinePluginDebug.js
vendored
File diff suppressed because it is too large
Load diff
2
plugins/spine/dist/SpinePluginDebug.js.map
vendored
2
plugins/spine/dist/SpinePluginDebug.js.map
vendored
File diff suppressed because one or more lines are too long
13
plugins/spine/src/runtimes/spine-both.d.ts
vendored
13
plugins/spine/src/runtimes/spine-both.d.ts
vendored
|
@ -636,7 +636,7 @@ declare module spine {
|
|||
private queueAsset;
|
||||
loadText(clientId: string, path: string): void;
|
||||
loadJson(clientId: string, path: string): void;
|
||||
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
|
||||
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement | ImageBitmap) => any, path: string): void;
|
||||
get(clientId: string, path: string): any;
|
||||
private updateClientAssets;
|
||||
isLoadingComplete(clientId: string): boolean;
|
||||
|
@ -881,9 +881,9 @@ declare module spine {
|
|||
}
|
||||
declare module spine {
|
||||
abstract class Texture {
|
||||
protected _image: HTMLImageElement;
|
||||
constructor(image: HTMLImageElement);
|
||||
getImage(): HTMLImageElement;
|
||||
protected _image: HTMLImageElement | ImageBitmap;
|
||||
constructor(image: HTMLImageElement | ImageBitmap);
|
||||
getImage(): HTMLImageElement | ImageBitmap;
|
||||
abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
abstract dispose(): void;
|
||||
|
@ -1400,7 +1400,7 @@ declare module spine.webgl {
|
|||
private boundUnit;
|
||||
private useMipMaps;
|
||||
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement, useMipMaps?: boolean);
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
|
||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear;
|
||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
|
@ -1738,7 +1738,8 @@ declare module spine.webgl {
|
|||
canvas: HTMLCanvasElement | OffscreenCanvas;
|
||||
gl: WebGLRenderingContext;
|
||||
private restorables;
|
||||
constructor(canvasOrContext: HTMLCanvasElement | WebGLRenderingContext, contextConfig?: any);
|
||||
constructor(canvasOrContext: HTMLCanvasElement | WebGLRenderingContext | EventTarget | WebGL2RenderingContext, contextConfig?: any);
|
||||
private setupCanvas;
|
||||
addRestorable(restorable: Restorable): void;
|
||||
removeRestorable(restorable: Restorable): void;
|
||||
}
|
||||
|
|
|
@ -3572,15 +3572,35 @@ var spine;
|
|||
path = this.pathPrefix + path;
|
||||
if (!this.queueAsset(clientId, textureLoader, path))
|
||||
return;
|
||||
var img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.onload = function (ev) {
|
||||
_this.rawAssets[path] = img;
|
||||
};
|
||||
img.onerror = function (ev) {
|
||||
_this.errors[path] = "Couldn't load image " + path;
|
||||
};
|
||||
img.src = path;
|
||||
var isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document);
|
||||
var isWebWorker = !isBrowser && typeof importScripts !== 'undefined';
|
||||
if (isWebWorker) {
|
||||
var options = { mode: "cors" };
|
||||
fetch(path, options).then(function (response) {
|
||||
if (!response.ok) {
|
||||
_this.errors[path] = "Couldn't load image " + path;
|
||||
}
|
||||
return response.blob();
|
||||
}).then(function (blob) {
|
||||
return createImageBitmap(blob, {
|
||||
premultiplyAlpha: 'none',
|
||||
colorSpaceConversion: 'none'
|
||||
});
|
||||
}).then(function (bitmap) {
|
||||
_this.rawAssets[path] = bitmap;
|
||||
});
|
||||
}
|
||||
else {
|
||||
var img_1 = new Image();
|
||||
img_1.crossOrigin = "anonymous";
|
||||
img_1.onload = function (ev) {
|
||||
_this.rawAssets[path] = img_1;
|
||||
};
|
||||
img_1.onerror = function (ev) {
|
||||
_this.errors[path] = "Couldn't load image " + path;
|
||||
};
|
||||
img_1.src = path;
|
||||
}
|
||||
};
|
||||
SharedAssetManager.prototype.get = function (clientId, path) {
|
||||
path = this.pathPrefix + path;
|
||||
|
@ -3590,6 +3610,8 @@ var spine;
|
|||
return clientAssets.assets[path];
|
||||
};
|
||||
SharedAssetManager.prototype.updateClientAssets = function (clientAssets) {
|
||||
var isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document);
|
||||
var isWebWorker = !isBrowser && typeof importScripts !== 'undefined';
|
||||
for (var i = 0; i < clientAssets.toLoad.length; i++) {
|
||||
var path = clientAssets.toLoad[i];
|
||||
var asset = clientAssets.assets[path];
|
||||
|
@ -3597,11 +3619,21 @@ var spine;
|
|||
var rawAsset = this.rawAssets[path];
|
||||
if (rawAsset === null || rawAsset === undefined)
|
||||
continue;
|
||||
if (rawAsset instanceof HTMLImageElement) {
|
||||
clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
|
||||
if (isWebWorker) {
|
||||
if (rawAsset instanceof ImageBitmap) {
|
||||
clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
|
||||
}
|
||||
else {
|
||||
clientAssets.assets[path] = rawAsset;
|
||||
}
|
||||
}
|
||||
else {
|
||||
clientAssets.assets[path] = rawAsset;
|
||||
if (rawAsset instanceof HTMLImageElement) {
|
||||
clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
|
||||
}
|
||||
else {
|
||||
clientAssets.assets[path] = rawAsset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7749,7 +7781,7 @@ var spine;
|
|||
return _this;
|
||||
}
|
||||
BoundingBoxAttachment.prototype.copy = function () {
|
||||
var copy = new BoundingBoxAttachment(name);
|
||||
var copy = new BoundingBoxAttachment(this.name);
|
||||
this.copyTo(copy);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
|
@ -7768,7 +7800,7 @@ var spine;
|
|||
return _this;
|
||||
}
|
||||
ClippingAttachment.prototype.copy = function () {
|
||||
var copy = new ClippingAttachment(name);
|
||||
var copy = new ClippingAttachment(this.name);
|
||||
this.copyTo(copy);
|
||||
copy.endSlot = this.endSlot;
|
||||
copy.color.setFromColor(this.color);
|
||||
|
@ -7912,7 +7944,7 @@ var spine;
|
|||
return _this;
|
||||
}
|
||||
PathAttachment.prototype.copy = function () {
|
||||
var copy = new PathAttachment(name);
|
||||
var copy = new PathAttachment(this.name);
|
||||
this.copyTo(copy);
|
||||
copy.lengths = new Array(this.lengths.length);
|
||||
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
||||
|
@ -7946,7 +7978,7 @@ var spine;
|
|||
return Math.atan2(y, x) * spine.MathUtils.radDeg;
|
||||
};
|
||||
PointAttachment.prototype.copy = function () {
|
||||
var copy = new PointAttachment(name);
|
||||
var copy = new PointAttachment(this.name);
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.rotation = this.rotation;
|
||||
|
@ -10706,30 +10738,32 @@ var spine;
|
|||
(function (webgl) {
|
||||
var ManagedWebGLRenderingContext = (function () {
|
||||
function ManagedWebGLRenderingContext(canvasOrContext, contextConfig) {
|
||||
var _this = this;
|
||||
if (contextConfig === void 0) { contextConfig = { alpha: "true" }; }
|
||||
this.restorables = new Array();
|
||||
if (canvasOrContext instanceof HTMLCanvasElement) {
|
||||
var canvas_1 = canvasOrContext;
|
||||
this.gl = (canvas_1.getContext("webgl2", contextConfig) || canvas_1.getContext("webgl", contextConfig));
|
||||
this.canvas = canvas_1;
|
||||
canvas_1.addEventListener("webglcontextlost", function (e) {
|
||||
var event = e;
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
canvas_1.addEventListener("webglcontextrestored", function (e) {
|
||||
for (var i = 0, n = _this.restorables.length; i < n; i++) {
|
||||
_this.restorables[i].restore();
|
||||
}
|
||||
});
|
||||
if (canvasOrContext instanceof HTMLCanvasElement || canvasOrContext instanceof EventTarget) {
|
||||
this.setupCanvas(canvasOrContext, contextConfig);
|
||||
}
|
||||
else {
|
||||
this.gl = canvasOrContext;
|
||||
this.canvas = this.gl.canvas;
|
||||
}
|
||||
}
|
||||
ManagedWebGLRenderingContext.prototype.setupCanvas = function (canvas, contextConfig) {
|
||||
var _this = this;
|
||||
this.gl = (canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig));
|
||||
this.canvas = canvas;
|
||||
canvas.addEventListener("webglcontextlost", function (e) {
|
||||
var event = e;
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
canvas.addEventListener("webglcontextrestored", function (e) {
|
||||
for (var i = 0, n = _this.restorables.length; i < n; i++) {
|
||||
_this.restorables[i].restore();
|
||||
}
|
||||
});
|
||||
};
|
||||
ManagedWebGLRenderingContext.prototype.addRestorable = function (restorable) {
|
||||
this.restorables.push(restorable);
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
8
plugins/spine/src/runtimes/spine-canvas.d.ts
vendored
8
plugins/spine/src/runtimes/spine-canvas.d.ts
vendored
|
@ -636,7 +636,7 @@ declare module spine {
|
|||
private queueAsset;
|
||||
loadText(clientId: string, path: string): void;
|
||||
loadJson(clientId: string, path: string): void;
|
||||
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
|
||||
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement | ImageBitmap) => any, path: string): void;
|
||||
get(clientId: string, path: string): any;
|
||||
private updateClientAssets;
|
||||
isLoadingComplete(clientId: string): boolean;
|
||||
|
@ -881,9 +881,9 @@ declare module spine {
|
|||
}
|
||||
declare module spine {
|
||||
abstract class Texture {
|
||||
protected _image: HTMLImageElement;
|
||||
constructor(image: HTMLImageElement);
|
||||
getImage(): HTMLImageElement;
|
||||
protected _image: HTMLImageElement | ImageBitmap;
|
||||
constructor(image: HTMLImageElement | ImageBitmap);
|
||||
getImage(): HTMLImageElement | ImageBitmap;
|
||||
abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
abstract dispose(): void;
|
||||
|
|
|
@ -3572,15 +3572,35 @@ var spine;
|
|||
path = this.pathPrefix + path;
|
||||
if (!this.queueAsset(clientId, textureLoader, path))
|
||||
return;
|
||||
var img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.onload = function (ev) {
|
||||
_this.rawAssets[path] = img;
|
||||
};
|
||||
img.onerror = function (ev) {
|
||||
_this.errors[path] = "Couldn't load image " + path;
|
||||
};
|
||||
img.src = path;
|
||||
var isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document);
|
||||
var isWebWorker = !isBrowser && typeof importScripts !== 'undefined';
|
||||
if (isWebWorker) {
|
||||
var options = { mode: "cors" };
|
||||
fetch(path, options).then(function (response) {
|
||||
if (!response.ok) {
|
||||
_this.errors[path] = "Couldn't load image " + path;
|
||||
}
|
||||
return response.blob();
|
||||
}).then(function (blob) {
|
||||
return createImageBitmap(blob, {
|
||||
premultiplyAlpha: 'none',
|
||||
colorSpaceConversion: 'none'
|
||||
});
|
||||
}).then(function (bitmap) {
|
||||
_this.rawAssets[path] = bitmap;
|
||||
});
|
||||
}
|
||||
else {
|
||||
var img_1 = new Image();
|
||||
img_1.crossOrigin = "anonymous";
|
||||
img_1.onload = function (ev) {
|
||||
_this.rawAssets[path] = img_1;
|
||||
};
|
||||
img_1.onerror = function (ev) {
|
||||
_this.errors[path] = "Couldn't load image " + path;
|
||||
};
|
||||
img_1.src = path;
|
||||
}
|
||||
};
|
||||
SharedAssetManager.prototype.get = function (clientId, path) {
|
||||
path = this.pathPrefix + path;
|
||||
|
@ -3590,6 +3610,8 @@ var spine;
|
|||
return clientAssets.assets[path];
|
||||
};
|
||||
SharedAssetManager.prototype.updateClientAssets = function (clientAssets) {
|
||||
var isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document);
|
||||
var isWebWorker = !isBrowser && typeof importScripts !== 'undefined';
|
||||
for (var i = 0; i < clientAssets.toLoad.length; i++) {
|
||||
var path = clientAssets.toLoad[i];
|
||||
var asset = clientAssets.assets[path];
|
||||
|
@ -3597,11 +3619,21 @@ var spine;
|
|||
var rawAsset = this.rawAssets[path];
|
||||
if (rawAsset === null || rawAsset === undefined)
|
||||
continue;
|
||||
if (rawAsset instanceof HTMLImageElement) {
|
||||
clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
|
||||
if (isWebWorker) {
|
||||
if (rawAsset instanceof ImageBitmap) {
|
||||
clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
|
||||
}
|
||||
else {
|
||||
clientAssets.assets[path] = rawAsset;
|
||||
}
|
||||
}
|
||||
else {
|
||||
clientAssets.assets[path] = rawAsset;
|
||||
if (rawAsset instanceof HTMLImageElement) {
|
||||
clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
|
||||
}
|
||||
else {
|
||||
clientAssets.assets[path] = rawAsset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7749,7 +7781,7 @@ var spine;
|
|||
return _this;
|
||||
}
|
||||
BoundingBoxAttachment.prototype.copy = function () {
|
||||
var copy = new BoundingBoxAttachment(name);
|
||||
var copy = new BoundingBoxAttachment(this.name);
|
||||
this.copyTo(copy);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
|
@ -7768,7 +7800,7 @@ var spine;
|
|||
return _this;
|
||||
}
|
||||
ClippingAttachment.prototype.copy = function () {
|
||||
var copy = new ClippingAttachment(name);
|
||||
var copy = new ClippingAttachment(this.name);
|
||||
this.copyTo(copy);
|
||||
copy.endSlot = this.endSlot;
|
||||
copy.color.setFromColor(this.color);
|
||||
|
@ -7912,7 +7944,7 @@ var spine;
|
|||
return _this;
|
||||
}
|
||||
PathAttachment.prototype.copy = function () {
|
||||
var copy = new PathAttachment(name);
|
||||
var copy = new PathAttachment(this.name);
|
||||
this.copyTo(copy);
|
||||
copy.lengths = new Array(this.lengths.length);
|
||||
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
||||
|
@ -7946,7 +7978,7 @@ var spine;
|
|||
return Math.atan2(y, x) * spine.MathUtils.radDeg;
|
||||
};
|
||||
PointAttachment.prototype.copy = function () {
|
||||
var copy = new PointAttachment(name);
|
||||
var copy = new PointAttachment(this.name);
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.rotation = this.rotation;
|
||||
|
|
File diff suppressed because one or more lines are too long
13
plugins/spine/src/runtimes/spine-webgl.d.ts
vendored
13
plugins/spine/src/runtimes/spine-webgl.d.ts
vendored
|
@ -636,7 +636,7 @@ declare module spine {
|
|||
private queueAsset;
|
||||
loadText(clientId: string, path: string): void;
|
||||
loadJson(clientId: string, path: string): void;
|
||||
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
|
||||
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement | ImageBitmap) => any, path: string): void;
|
||||
get(clientId: string, path: string): any;
|
||||
private updateClientAssets;
|
||||
isLoadingComplete(clientId: string): boolean;
|
||||
|
@ -881,9 +881,9 @@ declare module spine {
|
|||
}
|
||||
declare module spine {
|
||||
abstract class Texture {
|
||||
protected _image: HTMLImageElement;
|
||||
constructor(image: HTMLImageElement);
|
||||
getImage(): HTMLImageElement;
|
||||
protected _image: HTMLImageElement | ImageBitmap;
|
||||
constructor(image: HTMLImageElement | ImageBitmap);
|
||||
getImage(): HTMLImageElement | ImageBitmap;
|
||||
abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
abstract dispose(): void;
|
||||
|
@ -1369,7 +1369,7 @@ declare module spine.webgl {
|
|||
private boundUnit;
|
||||
private useMipMaps;
|
||||
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement, useMipMaps?: boolean);
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
|
||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear;
|
||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
|
@ -1707,7 +1707,8 @@ declare module spine.webgl {
|
|||
canvas: HTMLCanvasElement | OffscreenCanvas;
|
||||
gl: WebGLRenderingContext;
|
||||
private restorables;
|
||||
constructor(canvasOrContext: HTMLCanvasElement | WebGLRenderingContext, contextConfig?: any);
|
||||
constructor(canvasOrContext: HTMLCanvasElement | WebGLRenderingContext | EventTarget | WebGL2RenderingContext, contextConfig?: any);
|
||||
private setupCanvas;
|
||||
addRestorable(restorable: Restorable): void;
|
||||
removeRestorable(restorable: Restorable): void;
|
||||
}
|
||||
|
|
|
@ -3572,15 +3572,35 @@ var spine;
|
|||
path = this.pathPrefix + path;
|
||||
if (!this.queueAsset(clientId, textureLoader, path))
|
||||
return;
|
||||
var img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.onload = function (ev) {
|
||||
_this.rawAssets[path] = img;
|
||||
};
|
||||
img.onerror = function (ev) {
|
||||
_this.errors[path] = "Couldn't load image " + path;
|
||||
};
|
||||
img.src = path;
|
||||
var isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document);
|
||||
var isWebWorker = !isBrowser && typeof importScripts !== 'undefined';
|
||||
if (isWebWorker) {
|
||||
var options = { mode: "cors" };
|
||||
fetch(path, options).then(function (response) {
|
||||
if (!response.ok) {
|
||||
_this.errors[path] = "Couldn't load image " + path;
|
||||
}
|
||||
return response.blob();
|
||||
}).then(function (blob) {
|
||||
return createImageBitmap(blob, {
|
||||
premultiplyAlpha: 'none',
|
||||
colorSpaceConversion: 'none'
|
||||
});
|
||||
}).then(function (bitmap) {
|
||||
_this.rawAssets[path] = bitmap;
|
||||
});
|
||||
}
|
||||
else {
|
||||
var img_1 = new Image();
|
||||
img_1.crossOrigin = "anonymous";
|
||||
img_1.onload = function (ev) {
|
||||
_this.rawAssets[path] = img_1;
|
||||
};
|
||||
img_1.onerror = function (ev) {
|
||||
_this.errors[path] = "Couldn't load image " + path;
|
||||
};
|
||||
img_1.src = path;
|
||||
}
|
||||
};
|
||||
SharedAssetManager.prototype.get = function (clientId, path) {
|
||||
path = this.pathPrefix + path;
|
||||
|
@ -3590,6 +3610,8 @@ var spine;
|
|||
return clientAssets.assets[path];
|
||||
};
|
||||
SharedAssetManager.prototype.updateClientAssets = function (clientAssets) {
|
||||
var isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document);
|
||||
var isWebWorker = !isBrowser && typeof importScripts !== 'undefined';
|
||||
for (var i = 0; i < clientAssets.toLoad.length; i++) {
|
||||
var path = clientAssets.toLoad[i];
|
||||
var asset = clientAssets.assets[path];
|
||||
|
@ -3597,11 +3619,21 @@ var spine;
|
|||
var rawAsset = this.rawAssets[path];
|
||||
if (rawAsset === null || rawAsset === undefined)
|
||||
continue;
|
||||
if (rawAsset instanceof HTMLImageElement) {
|
||||
clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
|
||||
if (isWebWorker) {
|
||||
if (rawAsset instanceof ImageBitmap) {
|
||||
clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
|
||||
}
|
||||
else {
|
||||
clientAssets.assets[path] = rawAsset;
|
||||
}
|
||||
}
|
||||
else {
|
||||
clientAssets.assets[path] = rawAsset;
|
||||
if (rawAsset instanceof HTMLImageElement) {
|
||||
clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
|
||||
}
|
||||
else {
|
||||
clientAssets.assets[path] = rawAsset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7749,7 +7781,7 @@ var spine;
|
|||
return _this;
|
||||
}
|
||||
BoundingBoxAttachment.prototype.copy = function () {
|
||||
var copy = new BoundingBoxAttachment(name);
|
||||
var copy = new BoundingBoxAttachment(this.name);
|
||||
this.copyTo(copy);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
|
@ -7768,7 +7800,7 @@ var spine;
|
|||
return _this;
|
||||
}
|
||||
ClippingAttachment.prototype.copy = function () {
|
||||
var copy = new ClippingAttachment(name);
|
||||
var copy = new ClippingAttachment(this.name);
|
||||
this.copyTo(copy);
|
||||
copy.endSlot = this.endSlot;
|
||||
copy.color.setFromColor(this.color);
|
||||
|
@ -7912,7 +7944,7 @@ var spine;
|
|||
return _this;
|
||||
}
|
||||
PathAttachment.prototype.copy = function () {
|
||||
var copy = new PathAttachment(name);
|
||||
var copy = new PathAttachment(this.name);
|
||||
this.copyTo(copy);
|
||||
copy.lengths = new Array(this.lengths.length);
|
||||
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
||||
|
@ -7946,7 +7978,7 @@ var spine;
|
|||
return Math.atan2(y, x) * spine.MathUtils.radDeg;
|
||||
};
|
||||
PointAttachment.prototype.copy = function () {
|
||||
var copy = new PointAttachment(name);
|
||||
var copy = new PointAttachment(this.name);
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.rotation = this.rotation;
|
||||
|
@ -10438,30 +10470,32 @@ var spine;
|
|||
(function (webgl) {
|
||||
var ManagedWebGLRenderingContext = (function () {
|
||||
function ManagedWebGLRenderingContext(canvasOrContext, contextConfig) {
|
||||
var _this = this;
|
||||
if (contextConfig === void 0) { contextConfig = { alpha: "true" }; }
|
||||
this.restorables = new Array();
|
||||
if (canvasOrContext instanceof HTMLCanvasElement) {
|
||||
var canvas = canvasOrContext;
|
||||
this.gl = (canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig));
|
||||
this.canvas = canvas;
|
||||
canvas.addEventListener("webglcontextlost", function (e) {
|
||||
var event = e;
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
canvas.addEventListener("webglcontextrestored", function (e) {
|
||||
for (var i = 0, n = _this.restorables.length; i < n; i++) {
|
||||
_this.restorables[i].restore();
|
||||
}
|
||||
});
|
||||
if (canvasOrContext instanceof HTMLCanvasElement || canvasOrContext instanceof EventTarget) {
|
||||
this.setupCanvas(canvasOrContext, contextConfig);
|
||||
}
|
||||
else {
|
||||
this.gl = canvasOrContext;
|
||||
this.canvas = this.gl.canvas;
|
||||
}
|
||||
}
|
||||
ManagedWebGLRenderingContext.prototype.setupCanvas = function (canvas, contextConfig) {
|
||||
var _this = this;
|
||||
this.gl = (canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig));
|
||||
this.canvas = canvas;
|
||||
canvas.addEventListener("webglcontextlost", function (e) {
|
||||
var event = e;
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
canvas.addEventListener("webglcontextrestored", function (e) {
|
||||
for (var i = 0, n = _this.restorables.length; i < n; i++) {
|
||||
_this.restorables[i].restore();
|
||||
}
|
||||
});
|
||||
};
|
||||
ManagedWebGLRenderingContext.prototype.addRestorable = function (restorable) {
|
||||
this.restorables.push(restorable);
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue