From 8fc251f55e75b5a18a7bd4ecc540e9babeb1692f Mon Sep 17 00:00:00 2001 From: badlogic Date: Thu, 13 Dec 2018 17:51:01 +0100 Subject: [PATCH] [ts] Allow negative scale and shear mix in transform constraint. See #1227. --- spine-ts/build/spine-all.d.ts | 2 + spine-ts/build/spine-all.js | 46 +- spine-ts/build/spine-all.js.map | 2 +- spine-ts/build/spine-canvas.js | 8 +- spine-ts/build/spine-canvas.js.map | 2 +- spine-ts/build/spine-core.js | 8 +- spine-ts/build/spine-core.js.map | 2 +- spine-ts/build/spine-threejs.js | 8 +- spine-ts/build/spine-threejs.js.map | 2 +- spine-ts/build/spine-webgl.js | 8 +- spine-ts/build/spine-webgl.js.map | 2 +- spine-ts/build/spine-widget.d.ts | 3454 ++-- spine-ts/build/spine-widget.js | 21068 ++++++++++----------- spine-ts/build/spine-widget.js.map | 2 +- spine-ts/core/src/TransformConstraint.ts | 8 +- 15 files changed, 12329 insertions(+), 12293 deletions(-) diff --git a/spine-ts/build/spine-all.d.ts b/spine-ts/build/spine-all.d.ts index 1d65a4ae6..358b63caf 100644 --- a/spine-ts/build/spine-all.d.ts +++ b/spine-ts/build/spine-all.d.ts @@ -1788,6 +1788,7 @@ declare module spine { atlasUrl: string; animation: string; animations: string[]; + defaultMix: number; skin: string; skins: string[]; controlBones: string[]; @@ -1862,6 +1863,7 @@ declare module spine { validateConfig(config: SpinePlayerConfig): SpinePlayerConfig; showError(error: string): void; render(): HTMLElement; + private lastPopup; showSpeedDialog(speedButton: HTMLElement): void; showAnimationsDialog(animationsButton: HTMLElement): void; showSkinsDialog(skinButton: HTMLElement): void; diff --git a/spine-ts/build/spine-all.js b/spine-ts/build/spine-all.js index 0081c4135..3adfea6d8 100644 --- a/spine-ts/build/spine-all.js +++ b/spine-ts/build/spine-all.js @@ -5734,14 +5734,14 @@ var spine; y += (target.ay - y + this.data.offsetY) * translateMix; } var scaleX = bone.ascaleX, scaleY = bone.ascaleY; - if (scaleMix > 0) { + if (scaleMix != 0) { if (scaleX > 0.00001) scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX; if (scaleY > 0.00001) scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY; } var shearY = bone.ashearY; - if (shearMix > 0) { + if (shearMix != 0) { var r = target.ashearY - shearY + this.data.offsetShearY; r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360; bone.shearY += r * shearMix; @@ -5768,14 +5768,14 @@ var spine; y += (target.ay + this.data.offsetY) * translateMix; } var scaleX = bone.ascaleX, scaleY = bone.ascaleY; - if (scaleMix > 0) { + if (scaleMix != 0) { if (scaleX > 0.00001) scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1; if (scaleY > 0.00001) scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1; } var shearY = bone.ashearY; - if (shearMix > 0) + if (shearMix != 0) shearY += (target.ashearY + this.data.offsetShearY) * shearMix; bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY); } @@ -10120,7 +10120,7 @@ var spine; return; } if (!isContained(_this.dom, event.target)) { - _this.dom.parentNode.removeChild(_this.dom); + _this.dom.remove(); window.removeEventListener("click", windowClickListener); dismissedListener(); dismissed = true; @@ -10294,6 +10294,8 @@ var spine; config.controlBones = []; if (typeof config.showControls === "undefined") config.showControls = true; + if (typeof config.defaultMix === "undefined") + config.defaultMix = 0.25; return config; }; SpinePlayer.prototype.showError = function (error) { @@ -10416,6 +10418,13 @@ var spine; }; SpinePlayer.prototype.showSpeedDialog = function (speedButton) { var _this = this; + if (this.lastPopup) + this.lastPopup.dom.remove(); + if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Speed") { + this.lastPopup = null; + speedButton.classList.remove("spine-player-button-icon-speed-selected"); + return; + } var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t
Speed
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
0.1x
\n\t\t\t\t\t\t\t
1x
\n\t\t\t\t\t\t\t
2x
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t"); var sliderParent = findWithClass(popup.dom, "spine-player-speed-slider")[0]; var slider = new Slider(2, 0.1, true); @@ -10428,9 +10437,17 @@ var spine; popup.show(function () { speedButton.classList.remove("spine-player-button-icon-speed-selected"); }); + this.lastPopup = popup; }; SpinePlayer.prototype.showAnimationsDialog = function (animationsButton) { var _this = this; + if (this.lastPopup) + this.lastPopup.dom.remove(); + if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Animations") { + this.lastPopup = null; + animationsButton.classList.remove("spine-player-button-icon-animations-selected"); + return; + } if (!this.skeleton || this.skeleton.data.animations.length == 0) return; var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t
Animations
\n\t\t\t\t
\n\t\t\t\t\n\t\t\t"); @@ -10456,9 +10473,17 @@ var spine; popup.show(function () { animationsButton.classList.remove("spine-player-button-icon-animations-selected"); }); + this.lastPopup = popup; }; SpinePlayer.prototype.showSkinsDialog = function (skinButton) { var _this = this; + if (this.lastPopup) + this.lastPopup.dom.remove(); + if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Skins") { + this.lastPopup = null; + skinButton.classList.remove("spine-player-button-icon-skins-selected"); + return; + } if (!this.skeleton || this.skeleton.data.animations.length == 0) return; var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t
Skins
\n\t\t\t\t
\n\t\t\t\t\n\t\t\t"); @@ -10484,9 +10509,17 @@ var spine; popup.show(function () { skinButton.classList.remove("spine-player-button-icon-skins-selected"); }); + this.lastPopup = popup; }; SpinePlayer.prototype.showSettingsDialog = function (settingsButton) { var _this = this; + if (this.lastPopup) + this.lastPopup.dom.remove(); + if (this.lastPopup && findWithClass(this.lastPopup.dom, "spine-player-popup-title")[0].textContent == "Debug") { + this.lastPopup = null; + settingsButton.classList.remove("spine-player-button-icon-settings-selected"); + return; + } if (!this.skeleton || this.skeleton.data.animations.length == 0) return; var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t
Debug
\n\t\t\t\t
\n\t\t\t\t