Skip to content

Commit a434bc5

Browse files
committedJan 30, 2020
Remove calls to updateDrawableSkinIdRotationCenter
1 parent 8faad67 commit a434bc5

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed
 

‎src/import/load-costume.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,17 @@ const loadBitmap_ = function (costume, runtime, _rotationCenter) {
212212
return fetched;
213213
})
214214
.then(({canvas, mergeCanvas, rotationCenter}) => {
215-
// createBitmapSkin does the right thing if costume.bitmapResolution or rotationCenter are undefined...
216-
costume.skinId = runtime.renderer.createBitmapSkin(canvas, costume.bitmapResolution, rotationCenter);
215+
// createBitmapSkin does the right thing if costume.bitmapResolution is undefined...
216+
// TODO: is rotationCenter ever undefined?
217+
let center;
218+
if (rotationCenter) {
219+
center = [
220+
rotationCenter[0] / 2,
221+
rotationCenter[1] / 2
222+
];
223+
}
224+
225+
costume.skinId = runtime.renderer.createBitmapSkin(canvas, costume.bitmapResolution, center);
217226
canvasPool.release(mergeCanvas);
218227
const renderSize = runtime.renderer.getSkinSize(costume.skinId);
219228
costume.size = [renderSize[0] * 2, renderSize[1] * 2]; // Actual size, since all bitmaps are resolution 2

‎src/sprites/rendered-target.js

+2-18
Original file line numberDiff line numberDiff line change
@@ -458,19 +458,7 @@ class RenderedTarget extends Target {
458458
);
459459
if (this.renderer) {
460460
const costume = this.getCostumes()[this.currentCostume];
461-
if (
462-
typeof costume.rotationCenterX !== 'undefined' &&
463-
typeof costume.rotationCenterY !== 'undefined'
464-
) {
465-
const scale = costume.bitmapResolution || 2;
466-
const rotationCenter = [
467-
costume.rotationCenterX / scale,
468-
costume.rotationCenterY / scale
469-
];
470-
this.renderer.updateDrawableSkinIdRotationCenter(this.drawableID, costume.skinId, rotationCenter);
471-
} else {
472-
this.renderer.updateDrawableSkinId(this.drawableID, costume.skinId);
473-
}
461+
this.renderer.updateDrawableSkinId(this.drawableID, costume.skinId);
474462

475463
if (this.visible) {
476464
this.emit(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this);
@@ -709,11 +697,7 @@ class RenderedTarget extends Target {
709697
this.renderer.updateDrawableVisible(this.drawableID, this.visible);
710698

711699
const costume = this.getCostumes()[this.currentCostume];
712-
const bitmapResolution = costume.bitmapResolution || 2;
713-
this.renderer.updateDrawableSkinIdRotationCenter(this.drawableID, costume.skinId, [
714-
costume.rotationCenterX / bitmapResolution,
715-
costume.rotationCenterY / bitmapResolution
716-
]);
700+
this.renderer.updateDrawableSkinId(this.drawableID, costume.skinId);
717701

718702
for (const effectName in this.effects) {
719703
if (!this.effects.hasOwnProperty(effectName)) continue;

‎test/fixtures/fake-renderer.js

-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ FakeRenderer.prototype.getFencedPositionOfDrawable = function (d, p) { // eslint
1717
FakeRenderer.prototype.updateDrawableSkinId = function (d, skinId) { // eslint-disable-line no-unused-vars
1818
};
1919

20-
FakeRenderer.prototype.updateDrawableSkinIdRotationCenter =
21-
function (d, skinId, rotationCenter) {}; // eslint-disable-line no-unused-vars
22-
2320
FakeRenderer.prototype.updateDrawablePosition = function (d, position) { // eslint-disable-line no-unused-vars
2421
this.x = position[0];
2522
this.y = position[1];

0 commit comments

Comments
 (0)
Please sign in to comment.