diff --git a/src/next2d/display/DisplayObject.js b/src/next2d/display/DisplayObject.js index 98a016f..7c2e581 100644 --- a/src/next2d/display/DisplayObject.js +++ b/src/next2d/display/DisplayObject.js @@ -1933,9 +1933,6 @@ class DisplayObject extends EventDispatcher */ _$postProperty () { - this._$posted = true; - this._$updated = false; - const message = { "command": "setProperty", "instanceId": this._$instanceId, diff --git a/src/next2d/display/DisplayObjectContainer.js b/src/next2d/display/DisplayObjectContainer.js index cc90595..2e74227 100644 --- a/src/next2d/display/DisplayObjectContainer.js +++ b/src/next2d/display/DisplayObjectContainer.js @@ -2370,5 +2370,8 @@ class DisplayObjectContainer extends InteractiveObject .postMessage(message, options); Util.$poolArray(options); + + this._$posted = true; + this._$updated = false; } } diff --git a/src/next2d/display/Graphics.js b/src/next2d/display/Graphics.js index e29af0d..68e024f 100644 --- a/src/next2d/display/Graphics.js +++ b/src/next2d/display/Graphics.js @@ -1320,7 +1320,9 @@ class Graphics // cache current buffer const currentAttachment = context.frameBuffer.currentAttachment; - if (xMin > currentAttachment.width || yMin > currentAttachment.height) { + if (xMin > currentAttachment.width + || yMin > currentAttachment.height + ) { return; } @@ -1619,21 +1621,25 @@ class Graphics */ _$restart () { - if (this._$displayObject - && !this._$displayObject._$isUpdated() - ) { - this._$displayObject._$doChanged(); - Util.$isUpdated = true; + if (this._$displayObject) { + + this._$displayObject._$posted = false; this._$buffer = null; - Util - .$cacheStore() - .removeCache(this._$displayObject._$instanceId); + if (!this._$displayObject._$isUpdated()) { + + this._$displayObject._$doChanged(); + Util.$isUpdated = true; - if (this._$displayObject._$characterId) { Util .$cacheStore() - .removeCache(this._$displayObject._$characterId); + .removeCache(this._$displayObject._$instanceId); + + if (this._$displayObject._$characterId) { + Util + .$cacheStore() + .removeCache(this._$displayObject._$characterId); + } } } } diff --git a/src/next2d/display/Shape.js b/src/next2d/display/Shape.js index 75a0cfe..05d61d5 100644 --- a/src/next2d/display/Shape.js +++ b/src/next2d/display/Shape.js @@ -592,5 +592,8 @@ class Shape extends DisplayObject .postMessage(message); } + + this._$posted = true; + this._$updated = false; } } diff --git a/src/next2d/media/Video.js b/src/next2d/media/Video.js index c0ca65a..795ccba 100644 --- a/src/next2d/media/Video.js +++ b/src/next2d/media/Video.js @@ -1159,5 +1159,8 @@ class Video extends DisplayObject Util.$rendererWorker.postMessage(message, options); Util.$poolArray(options); + + this._$posted = true; + this._$updated = false; } } diff --git a/src/next2d/text/TextField.js b/src/next2d/text/TextField.js index c91503a..579bd59 100644 --- a/src/next2d/text/TextField.js +++ b/src/next2d/text/TextField.js @@ -178,13 +178,6 @@ class TextField extends InteractiveObject */ this._$textData = null; - /** - * @type {boolean} - * @default true - * @private - */ - this._$renew = true; - /** * @type {number} * @default null @@ -961,10 +954,10 @@ class TextField extends InteractiveObject text = `${text}`; if (text !== this._$text) { - this._$text = text; - this._$htmlText = ""; - this._$cacheText = ""; - this._$isHTML = false; + this._$text = text; + this._$htmlText = ""; + this._$cacheText = ""; + this._$isHTML = false; if (!this._$textAppending) { this._$textFormatTable = []; @@ -2153,7 +2146,6 @@ class TextField extends InteractiveObject */ _$reset () { - this._$renew = true; this._$textData = null; this._$imageData = null; this._$textHeight = null; @@ -2696,7 +2688,7 @@ class TextField extends InteractiveObject let texture = cacheStore.get(cacheKeys); // texture is small or renew - if (this._$renew || this._$isUpdated()) { + if (this._$isUpdated()) { cacheStore.removeCache(instanceId); texture = null; } @@ -2708,8 +2700,6 @@ class TextField extends InteractiveObject const baseWidth = $Math.ceil($Math.abs(baseBounds.xMax - baseBounds.xMin) * xScale); const baseHeight = $Math.ceil($Math.abs(baseBounds.yMax - baseBounds.yMin) * yScale); - this._$renew = false; - // alpha reset multiColor[3] = 1; @@ -3430,15 +3420,16 @@ class TextField extends InteractiveObject const message = super._$postProperty(); - message.xMin = this._$bounds.xMin; - message.yMin = this._$bounds.yMin; - message.xMax = this._$bounds.xMax; - message.yMax = this._$bounds.yMax; - message.textAreaActive = this._$textAreaActive; - if (this._$renew || this._$isUpdated()) { - this._$renew = false; + const bounds = this._$getBounds(null); + message.xMin = bounds.xMin; + message.yMin = bounds.yMin; + message.xMax = bounds.xMax; + message.yMax = bounds.yMax; + Util.$poolBoundsObject(bounds); + + if (this._$isUpdated()) { message.textData = this._$getTextData(); message.scrollV = this.scrollV; @@ -3472,5 +3463,8 @@ class TextField extends InteractiveObject Util .$rendererWorker .postMessage(message); + + this._$posted = true; + this._$updated = false; } } diff --git a/src/player/Next2D.js b/src/player/Next2D.js index 1120da3..9fc3657 100644 --- a/src/player/Next2D.js +++ b/src/player/Next2D.js @@ -115,16 +115,20 @@ class Next2D { const player = this._$player; - player._$loadStatus = Player.LOAD_END; - player._$mode = "create"; - player._$stage.frameRate = fps | 0; - // setup player.width = width | 0; player.height = height | 0; player.setOptions(options); - return player._$stage.addChild(new Sprite()); + player._$loadStatus = Player.LOAD_END; + player._$mode = "create"; + player._$stage._$frameRate = fps | 0; + + const root = player._$stage.addChild(new Sprite()); + + player.play(); + + return root; } } diff --git a/src/renderer/RenderBase.js b/src/renderer/RenderBase.js index d341409..c1c5a1a 100644 --- a/src/renderer/RenderBase.js +++ b/src/renderer/RenderBase.js @@ -37,14 +37,16 @@ class CommandController * @param {HTMLCanvasElement} canvas * @param {number} [samples=4] * @param {number} [devicePixelRatio=2] + * @param {boolean} [is_safari=false] * @return {void} * @method * @public */ - initialize (canvas, samples = 4, devicePixelRatio = 2) + initialize (canvas, samples = 4, devicePixelRatio = 2, is_safari = false) { // update $devicePixelRatio = devicePixelRatio; + Util.$isSafari = !!is_safari; const player = Util.$renderPlayer; player._$samples = samples; diff --git a/src/renderer/RenderTextField.js b/src/renderer/RenderTextField.js index 50b200f..f929a98 100644 --- a/src/renderer/RenderTextField.js +++ b/src/renderer/RenderTextField.js @@ -11,13 +11,6 @@ class RenderTextField extends RenderDisplayObject { super(); - /** - * @type {boolean} - * @default false - * @private - */ - this._$renew = false; - /** * @type {boolean} * @default false @@ -367,7 +360,6 @@ class RenderTextField extends RenderDisplayObject } const baseBounds = this._$getBounds(null); - baseBounds.xMin -= this._$thickness; baseBounds.xMax += this._$thickness; baseBounds.yMin -= this._$thickness; @@ -469,7 +461,7 @@ class RenderTextField extends RenderDisplayObject let texture = cacheStore.get(cacheKeys); // texture is small or renew - if (this._$renew) { + if (this._$isUpdated()) { cacheStore.removeCache(instanceId); texture = null; } @@ -481,8 +473,6 @@ class RenderTextField extends RenderDisplayObject const baseWidth = $Math.ceil($Math.abs(baseBounds.xMax - baseBounds.xMin) * xScale); const baseHeight = $Math.ceil($Math.abs(baseBounds.yMax - baseBounds.yMin) * yScale); - this._$renew = false; - // alpha reset multiColor[3] = 1; @@ -650,17 +640,17 @@ class RenderTextField extends RenderDisplayObject let yOffset = 0; if (this._$verticalAlign !== TextFormatVerticalAlign.TOP - && this.height > this.textHeight + && this.height > this._$textHeight ) { switch (this._$verticalAlign) { case TextFormatVerticalAlign.MIDDLE: - yOffset = (this.height - this.textHeight + 2) / 2; + yOffset = (this.height - this._$textHeight + 2) / 2; break; case TextFormatVerticalAlign.BOTTOM: - yOffset = this.height - this.textHeight + 2; + yOffset = this.height - this._$textHeight + 2; break; } @@ -710,7 +700,7 @@ class RenderTextField extends RenderDisplayObject currentV++; - if (this.scrollV > currentV) { + if (this._$scrollV > currentV) { continue; } @@ -740,7 +730,7 @@ class RenderTextField extends RenderDisplayObject case TextMode.TEXT: { - if (this.scrollV > currentV) { + if (this._$scrollV > currentV) { continue; } @@ -834,6 +824,8 @@ class RenderTextField extends RenderDisplayObject this._$yMax = 0; this._$textData = null; + this._$textAreaActive = false; + super._$remove(); Util.$textFields.push(this); @@ -852,7 +844,6 @@ class RenderTextField extends RenderDisplayObject // update property this._$textAreaActive = !!object.textAreaActive; - this._$renew = true; this._$textData = object.textData; this._$wordWrap = !!object.wordWrap;