mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-30 08:10:27 -04:00
Merge pull request #2329 from adroitwhiz/remove-updatedrawableproperties
Remove remaining updateDrawableProperties calls
This commit is contained in:
commit
7eabcb8a29
4 changed files with 26 additions and 36 deletions
|
@ -188,23 +188,21 @@ class Scratch3LooksBlocks {
|
||||||
bubbleState.onSpriteRight = true;
|
bubbleState.onSpriteRight = true;
|
||||||
this._renderBubble(target);
|
this._renderBubble(target);
|
||||||
} else {
|
} else {
|
||||||
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
|
this.runtime.renderer.updateDrawablePosition(bubbleState.drawableId, [
|
||||||
position: [
|
bubbleState.onSpriteRight ? (
|
||||||
bubbleState.onSpriteRight ? (
|
Math.max(
|
||||||
Math.max(
|
stageBounds.left, // Bubble should not extend past left edge of stage
|
||||||
stageBounds.left, // Bubble should not extend past left edge of stage
|
Math.min(stageBounds.right - bubbleWidth, targetBounds.right)
|
||||||
Math.min(stageBounds.right - bubbleWidth, targetBounds.right)
|
)
|
||||||
)
|
) : (
|
||||||
) : (
|
Math.min(
|
||||||
Math.min(
|
stageBounds.right - bubbleWidth, // Bubble should not extend past right edge of stage
|
||||||
stageBounds.right - bubbleWidth, // Bubble should not extend past right edge of stage
|
Math.max(stageBounds.left, targetBounds.left - bubbleWidth)
|
||||||
Math.max(stageBounds.left, targetBounds.left - bubbleWidth)
|
)
|
||||||
)
|
),
|
||||||
),
|
// Bubble should not extend past the top of the stage
|
||||||
// Bubble should not extend past the top of the stage
|
Math.min(stageBounds.top, targetBounds.bottom + bubbleHeight)
|
||||||
Math.min(stageBounds.top, targetBounds.bottom + bubbleHeight)
|
]);
|
||||||
]
|
|
||||||
});
|
|
||||||
this.runtime.requestRedraw();
|
this.runtime.requestRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,9 +233,7 @@ class Scratch3LooksBlocks {
|
||||||
target.addListener(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this._onTargetChanged);
|
target.addListener(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this._onTargetChanged);
|
||||||
bubbleState.drawableId = this.runtime.renderer.createDrawable(StageLayering.SPRITE_LAYER);
|
bubbleState.drawableId = this.runtime.renderer.createDrawable(StageLayering.SPRITE_LAYER);
|
||||||
bubbleState.skinId = this.runtime.renderer.createTextSkin(type, text, bubbleState.onSpriteRight, [0, 0]);
|
bubbleState.skinId = this.runtime.renderer.createTextSkin(type, text, bubbleState.onSpriteRight, [0, 0]);
|
||||||
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
|
this.runtime.renderer.updateDrawableSkinId(bubbleState.drawableId, bubbleState.skinId);
|
||||||
skinId: bubbleState.skinId
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._positionBubble(target);
|
this._positionBubble(target);
|
||||||
|
|
|
@ -133,7 +133,7 @@ class Scratch3PenBlocks {
|
||||||
if (this._penSkinId < 0 && this.runtime.renderer) {
|
if (this._penSkinId < 0 && this.runtime.renderer) {
|
||||||
this._penSkinId = this.runtime.renderer.createPenSkin();
|
this._penSkinId = this.runtime.renderer.createPenSkin();
|
||||||
this._penDrawableId = this.runtime.renderer.createDrawable(StageLayering.PEN_LAYER);
|
this._penDrawableId = this.runtime.renderer.createDrawable(StageLayering.PEN_LAYER);
|
||||||
this.runtime.renderer.updateDrawableProperties(this._penDrawableId, {skinId: this._penSkinId});
|
this.runtime.renderer.updateDrawableSkinId(this._penDrawableId, this._penSkinId);
|
||||||
}
|
}
|
||||||
return this._penSkinId;
|
return this._penSkinId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,16 +128,18 @@ class Video {
|
||||||
this._ghost = ghost;
|
this._ghost = ghost;
|
||||||
// Confirm that the default value has been changed to a valid id for the drawable
|
// Confirm that the default value has been changed to a valid id for the drawable
|
||||||
if (this._drawable !== -1) {
|
if (this._drawable !== -1) {
|
||||||
this.runtime.renderer.updateDrawableProperties(this._drawable, {
|
this.runtime.renderer.updateDrawableEffect(
|
||||||
ghost: this._forceTransparentPreview ? 100 : ghost
|
this._drawable,
|
||||||
});
|
'ghost',
|
||||||
|
this._forceTransparentPreview ? 100 : ghost
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_disablePreview () {
|
_disablePreview () {
|
||||||
if (this._skinId !== -1) {
|
if (this._skinId !== -1) {
|
||||||
this.runtime.renderer.updateBitmapSkin(this._skinId, new ImageData(...Video.DIMENSIONS), 1);
|
this.runtime.renderer.updateBitmapSkin(this._skinId, new ImageData(...Video.DIMENSIONS), 1);
|
||||||
this.runtime.renderer.updateDrawableProperties(this._drawable, {visible: false});
|
this.runtime.renderer.updateDrawableVisible(this._drawable, false);
|
||||||
}
|
}
|
||||||
this._renderPreviewFrame = null;
|
this._renderPreviewFrame = null;
|
||||||
}
|
}
|
||||||
|
@ -149,17 +151,13 @@ class Video {
|
||||||
if (this._skinId === -1 && this._drawable === -1) {
|
if (this._skinId === -1 && this._drawable === -1) {
|
||||||
this._skinId = renderer.createBitmapSkin(new ImageData(...Video.DIMENSIONS), 1);
|
this._skinId = renderer.createBitmapSkin(new ImageData(...Video.DIMENSIONS), 1);
|
||||||
this._drawable = renderer.createDrawable(StageLayering.VIDEO_LAYER);
|
this._drawable = renderer.createDrawable(StageLayering.VIDEO_LAYER);
|
||||||
renderer.updateDrawableProperties(this._drawable, {
|
renderer.updateDrawableSkinId(this._drawable, this._skinId);
|
||||||
skinId: this._skinId
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we haven't already created and started a preview frame render loop, do so
|
// if we haven't already created and started a preview frame render loop, do so
|
||||||
if (!this._renderPreviewFrame) {
|
if (!this._renderPreviewFrame) {
|
||||||
renderer.updateDrawableProperties(this._drawable, {
|
renderer.updateDrawableEffect(this._drawable, 'ghost', this._forceTransparentPreview ? 100 : this._ghost);
|
||||||
ghost: this._forceTransparentPreview ? 100 : this._ghost,
|
renderer.updateDrawableVisible(this._drawable, true);
|
||||||
visible: true
|
|
||||||
});
|
|
||||||
|
|
||||||
this._renderPreviewFrame = () => {
|
this._renderPreviewFrame = () => {
|
||||||
clearTimeout(this._renderPreviewTimeout);
|
clearTimeout(this._renderPreviewTimeout);
|
||||||
|
|
4
test/fixtures/fake-renderer.js
vendored
4
test/fixtures/fake-renderer.js
vendored
|
@ -31,10 +31,6 @@ FakeRenderer.prototype.updateDrawableVisible = function (d, visible) { // eslint
|
||||||
FakeRenderer.prototype.updateDrawableEffect = function (d, effectName, value) { // eslint-disable-line no-unused-vars
|
FakeRenderer.prototype.updateDrawableEffect = function (d, effectName, value) { // eslint-disable-line no-unused-vars
|
||||||
};
|
};
|
||||||
|
|
||||||
FakeRenderer.prototype.updateDrawableProperties = function (d, p) { // eslint-disable-line no-unused-vars
|
|
||||||
throw new Error('updateDrawableProperties is deprecated');
|
|
||||||
};
|
|
||||||
|
|
||||||
FakeRenderer.prototype.getCurrentSkinSize = function (d) { // eslint-disable-line no-unused-vars
|
FakeRenderer.prototype.getCurrentSkinSize = function (d) { // eslint-disable-line no-unused-vars
|
||||||
return [0, 0];
|
return [0, 0];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue