Unified · Split
| @@ -44,14 +44,20 @@ app.views.Resizer = class Resizer extends app.View { · 43 unmodified lines | |||
| 44 | return; | 44 | return; |
| 45 | } | 45 | } |
| 46 | this.lastDragValue = value; | 46 | this.lastDragValue = value; |
| 47 | if (this.lastDrag && this.lastDrag > Date.now() - 50) { | 47 | if (this.rafPending) { |
| 48 | return; | 48 | return; |
| 49 | } | 49 | } |
| 50 | this.lastDrag = Date.now(); | 50 | this.rafPending = requestAnimationFrame(() => { |
| 51 | this.resize(value, false); | 51 | this.rafPending = null; |
| 52 | this.resize(this.lastDragValue, false); | ||
| 53 | }); | ||
| 52 | } | 54 | } |
| 53 | 55 | ||
| 54 | onDragEnd(event) { | 56 | onDragEnd(event) { |
| 57 | if (this.rafPending) { | ||
| 58 | cancelAnimationFrame(this.rafPending); | ||
| 59 | this.rafPending = null; | ||
| 60 | } | ||
| 55 | $.off(window, "dragover", this.onDrag); | 61 | $.off(window, "dragover", this.onDrag); |
| 56 | let value = event.pageX || event.screenX - window.screenX; | 62 | let value = event.pageX || event.screenX - window.screenX; |
| 57 | if ( | 63 | if ( |