diff --git a/spine-ts/build/spine-widget.d.ts b/spine-ts/build/spine-widget.d.ts index c82982cc9..7ecd158e9 100644 --- a/spine-ts/build/spine-widget.d.ts +++ b/spine-ts/build/spine-widget.d.ts @@ -1692,7 +1692,6 @@ declare module spine { x: number; y: number; alpha: boolean; - fitToCanvas: boolean; backgroundColor: string; premultipliedAlpha: boolean; success: (widget: SpineWidget) => void; @@ -1705,9 +1704,13 @@ declare module spine { private context; private loadingScreen; private assetManager; + private timelineSlider; private loaded; private skeleton; private animationState; + private time; + private paused; + private currentAnimation; constructor(parent: HTMLElement, config: SpinePlayerConfig); validateConfig(config: SpinePlayerConfig): SpinePlayerConfig; render(parent: HTMLElement, config: SpinePlayerConfig): void; diff --git a/spine-ts/build/spine-widget.js b/spine-ts/build/spine-widget.js index ddfbc8451..2874c9b2a 100644 --- a/spine-ts/build/spine-widget.js +++ b/spine-ts/build/spine-widget.js @@ -9396,9 +9396,53 @@ var spine; })(spine || (spine = {})); var spine; (function (spine) { + var Slider = (function () { + function Slider(parent) { + var _this = this; + parent.innerHTML = "\n\t\t\t\t
\n\t\t\t"; + this.slider = findWithClass(parent, "spine-player-slider")[0]; + this.value = findWithClass(parent, "spine-player-slider-value")[0]; + this.setValue(0); + var input = new spine.webgl.Input(this.slider); + var dragging = false; + input.addListener({ + down: function (x, y) { + dragging = true; + }, + up: function (x, y) { + dragging = false; + var percentage = x / _this.slider.clientWidth; + _this.setValue(x / _this.slider.clientWidth); + if (_this.change) + _this.change(percentage); + }, + moved: function (x, y) { + if (dragging) { + var percentage = x / _this.slider.clientWidth; + _this.setValue(x / _this.slider.clientWidth); + if (_this.change) + _this.change(percentage); + } + }, + dragged: function (x, y) { + var percentage = x / _this.slider.clientWidth; + _this.setValue(x / _this.slider.clientWidth); + if (_this.change) + _this.change(percentage); + } + }); + } + Slider.prototype.setValue = function (percentage) { + percentage = Math.max(0, Math.min(1, percentage)); + this.value.style.width = "" + (percentage * 100) + "%"; + }; + return Slider; + }()); var SpinePlayer = (function () { function SpinePlayer(parent, config) { this.config = config; + this.time = new spine.TimeKeeper(); + this.paused = true; this.validateConfig(config); this.render(parent, config); } @@ -9417,8 +9461,6 @@ var spine; config.y = 0; if (!config.alpha) config.alpha = false; - if (!config.fitToCanvas) - config.fitToCanvas = true; if (!config.backgroundColor) config.backgroundColor = "#000000"; if (!config.premultipliedAlpha) @@ -9431,14 +9473,8 @@ var spine; }; SpinePlayer.prototype.render = function (parent, config) { var _this = this; - parent.innerHTML = "\n\t\t\t\t