Skip to content

Commit

Permalink
Issue #231 - remove extra if condition which will never be entered
Browse files Browse the repository at this point in the history
  • Loading branch information
kmanaseryan committed Sep 27, 2021
1 parent 6b22b1f commit a6e5210
Showing 1 changed file with 24 additions and 47 deletions.
71 changes: 24 additions & 47 deletions src/js/core/base-layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,60 +300,37 @@ class Base_layers_class {
//example with canvas object - other types should overwrite this method
if (object.type == "image") {
//image - default behavior
var rotateSupport = true;
if (rotateSupport == false) {
if (object.link_canvas != null) {
//we have draft canvas - use it
ctx.drawImage(
object.link_canvas,
object.x,
object.y,
object.width,
object.height
);
} else {
ctx.drawImage(
object.link,
object.x,
object.y,
object.width,
object.height
);
}
ctx.save();

ctx.translate(
object.x + object.width / 2,
object.y + object.height / 2
);
ctx.rotate((object.rotate * Math.PI) / 180);
if (object.link_canvas != null) {
//we have draft canvas - use it
ctx.drawImage(
object.link_canvas,
-object.width / 2,
-object.height / 2,
object.width,
object.height
);
} else {
ctx.save();

ctx.translate(
object.x + object.width / 2,
object.y + object.height / 2
ctx.drawImage(
object.link,
-object.width / 2,
-object.height / 2,
object.width,
object.height
);
ctx.rotate((object.rotate * Math.PI) / 180);
if (object.link_canvas != null) {
//we have draft canvas - use it
ctx.drawImage(
object.link_canvas,
-object.width / 2,
-object.height / 2,
object.width,
object.height
);
} else {
ctx.drawImage(
object.link,
-object.width / 2,
-object.height / 2,
object.width,
object.height
);
}

ctx.restore();
}

ctx.restore();
} else {
//call render function from other module
var render_class = object.render_function[0];
var render_function = object.render_function[1];

if (
typeof this.Base_gui.GUI_tools.tools_modules[render_class] !=
"undefined"
Expand Down

0 comments on commit a6e5210

Please sign in to comment.