Simplify the Boolean condition used in _useBufferCanvas()

The original Boolean condition duplicates most of the predicates
used in both parts of the "or" expression. It is enough to test
them just once, which also makes it easier to figure out what
the criterion for using the buffer canvas is. (An extra effect
is that the code becomes smaller and potentially quicker for the
JIT compiler to handle, but I don't expect much reduction here.)
This commit is contained in:
VladimirTechMan 2019-01-12 21:49:21 +03:00
parent fd2ff292e1
commit d5523bb11b

View File

@ -218,18 +218,12 @@ export class Shape extends Node {
}
_useBufferCanvas(caching) {
return (
(!caching &&
(this.perfectDrawEnabled() &&
this.getAbsoluteOpacity() !== 1 &&
this.hasFill() &&
this.hasStroke() &&
this.getStage())) ||
(this.perfectDrawEnabled() &&
this.hasShadow() &&
this.getAbsoluteOpacity() !== 1 &&
this.hasFill() &&
this.hasStroke() &&
this.getStage())
(!caching || this.hasShadow()) &&
this.perfectDrawEnabled() &&
this.getAbsoluteOpacity() !== 1 &&
this.hasFill() &&
this.hasStroke() &&
this.getStage()
);
}
/**