Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remaining updateDrawableProperties calls #2329

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions src/blocks/scratch3_looks.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,21 @@ class Scratch3LooksBlocks {
bubbleState.onSpriteRight = true;
this._renderBubble(target);
} else {
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
position: [
bubbleState.onSpriteRight ? (
Math.max(
stageBounds.left, // Bubble should not extend past left edge of stage
Math.min(stageBounds.right - bubbleWidth, targetBounds.right)
)
) : (
Math.min(
stageBounds.right - bubbleWidth, // Bubble should not extend past right edge of stage
Math.max(stageBounds.left, targetBounds.left - bubbleWidth)
)
),
// Bubble should not extend past the top of the stage
Math.min(stageBounds.top, targetBounds.bottom + bubbleHeight)
]
});
this.runtime.renderer.updateDrawablePosition(bubbleState.drawableId, [
bubbleState.onSpriteRight ? (
Math.max(
stageBounds.left, // Bubble should not extend past left edge of stage
Math.min(stageBounds.right - bubbleWidth, targetBounds.right)
)
) : (
Math.min(
stageBounds.right - bubbleWidth, // Bubble should not extend past right edge of stage
Math.max(stageBounds.left, targetBounds.left - bubbleWidth)
)
),
// Bubble should not extend past the top of the stage
Math.min(stageBounds.top, targetBounds.bottom + bubbleHeight)
]);
this.runtime.requestRedraw();
}
}
Expand Down Expand Up @@ -225,9 +223,7 @@ class Scratch3LooksBlocks {
target.addListener(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this._onTargetChanged);
bubbleState.drawableId = this.runtime.renderer.createDrawable(StageLayering.SPRITE_LAYER);
bubbleState.skinId = this.runtime.renderer.createTextSkin(type, text, bubbleState.onSpriteRight, [0, 0]);
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
skinId: bubbleState.skinId
});
this.runtime.renderer.updateDrawableSkinId(bubbleState.drawableId, bubbleState.skinId);
}

this._positionBubble(target);
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/scratch3_pen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Scratch3PenBlocks {
if (this._penSkinId < 0 && this.runtime.renderer) {
this._penSkinId = this.runtime.renderer.createPenSkin();
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;
}
Expand Down
20 changes: 9 additions & 11 deletions src/io/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,18 @@ class Video {
this._ghost = ghost;
// Confirm that the default value has been changed to a valid id for the drawable
if (this._drawable !== -1) {
this.runtime.renderer.updateDrawableProperties(this._drawable, {
ghost: this._forceTransparentPreview ? 100 : ghost
});
this.runtime.renderer.updateDrawableEffect(
this._drawable,
'ghost',
this._forceTransparentPreview ? 100 : ghost
);
}
}

_disablePreview () {
if (this._skinId !== -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;
}
Expand All @@ -149,17 +151,13 @@ class Video {
if (this._skinId === -1 && this._drawable === -1) {
this._skinId = renderer.createBitmapSkin(new ImageData(...Video.DIMENSIONS), 1);
this._drawable = renderer.createDrawable(StageLayering.VIDEO_LAYER);
renderer.updateDrawableProperties(this._drawable, {
skinId: this._skinId
});
renderer.updateDrawableSkinId(this._drawable, this._skinId);
}

// if we haven't already created and started a preview frame render loop, do so
if (!this._renderPreviewFrame) {
renderer.updateDrawableProperties(this._drawable, {
ghost: this._forceTransparentPreview ? 100 : this._ghost,
visible: true
});
renderer.updateDrawableEffect(this._drawable, 'ghost', this._forceTransparentPreview ? 100 : this._ghost);
renderer.updateDrawableVisible(this._drawable, true);

this._renderPreviewFrame = () => {
clearTimeout(this._renderPreviewTimeout);
Expand Down
4 changes: 0 additions & 4 deletions test/fixtures/fake-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ FakeRenderer.prototype.updateDrawableVisible = function (d, visible) { // eslint
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
return [0, 0];
};
Expand Down