Allow highlight without animation
Browse files
assets/scripts/src/overlay.js
CHANGED
|
@@ -38,7 +38,7 @@ export default class Overlay {
|
|
| 38 |
}
|
| 39 |
|
| 40 |
// Highlights the dom element on the screen
|
| 41 |
-
highlight(element) {
|
| 42 |
if (!element) {
|
| 43 |
return;
|
| 44 |
}
|
|
@@ -51,6 +51,13 @@ export default class Overlay {
|
|
| 51 |
|
| 52 |
this.highlightedElement = element;
|
| 53 |
this.positionToHighlight = position;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
this.draw();
|
| 55 |
}
|
| 56 |
|
|
|
|
| 38 |
}
|
| 39 |
|
| 40 |
// Highlights the dom element on the screen
|
| 41 |
+
highlight(element, animate = true) {
|
| 42 |
if (!element) {
|
| 43 |
return;
|
| 44 |
}
|
|
|
|
| 51 |
|
| 52 |
this.highlightedElement = element;
|
| 53 |
this.positionToHighlight = position;
|
| 54 |
+
|
| 55 |
+
// If animation is not required then set the last path to be same
|
| 56 |
+
// as the current path so that there is no easing towards it
|
| 57 |
+
if (!animate) {
|
| 58 |
+
this.highlightedPosition = this.positionToHighlight;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
this.draw();
|
| 62 |
}
|
| 63 |
|