mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 14:07:16 +08:00
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:
parent
fd2ff292e1
commit
d5523bb11b
18
src/Shape.ts
18
src/Shape.ts
@ -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()
|
||||
);
|
||||
}
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user