@sudobility/music_drawing 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/keyboard-geometry.d.ts +6 -18
- package/dist/keyboard-geometry.d.ts.map +1 -1
- package/dist/keyboard-geometry.js.map +1 -1
- package/dist/keyboard-keys.d.ts +2 -2
- package/dist/keyboard-keys.d.ts.map +1 -1
- package/dist/keyboard-keys.js.map +1 -1
- package/dist/pagination.d.ts +1 -7
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +0 -4
- package/dist/pagination.js.map +1 -1
- package/dist/playback-binding.d.ts +2 -0
- package/dist/playback-binding.d.ts.map +1 -1
- package/dist/playback-binding.js +13 -0
- package/dist/playback-binding.js.map +1 -1
- package/dist/playback-scroll.d.ts +23 -1
- package/dist/playback-scroll.d.ts.map +1 -1
- package/dist/playback-scroll.js +0 -21
- package/dist/playback-scroll.js.map +1 -1
- package/dist/playing-pitches.d.ts +44 -0
- package/dist/playing-pitches.d.ts.map +1 -0
- package/dist/playing-pitches.js +50 -0
- package/dist/playing-pitches.js.map +1 -0
- package/dist/print-plan.d.ts +2 -19
- package/dist/print-plan.d.ts.map +1 -1
- package/dist/print-plan.js +1 -33
- package/dist/print-plan.js.map +1 -1
- package/dist/score-canvas.d.ts +20 -23
- package/dist/score-canvas.d.ts.map +1 -1
- package/dist/score-canvas.js +32 -2
- package/dist/score-canvas.js.map +1 -1
- package/dist/types.d.ts +5 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -17
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/dist/out-of-range.d.ts +0 -67
- package/dist/out-of-range.d.ts.map +0 -1
- package/dist/out-of-range.js +0 -101
- package/dist/out-of-range.js.map +0 -1
- package/dist/press.d.ts +0 -66
- package/dist/press.d.ts.map +0 -1
- package/dist/press.js +0 -64
- package/dist/press.js.map +0 -1
package/dist/press.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What a press on the score was: a tap, a long press, or a drag.
|
|
3
|
-
*
|
|
4
|
-
* Both apps answer this at the end of every press, and they answered it with
|
|
5
|
-
* different numbers in different files — the web's `DRAG_THRESHOLD` inside the
|
|
6
|
-
* notation view, the native app's `LONG_PRESS_MS`/`LONG_PRESS_SLOP` inside its
|
|
7
|
-
* scrolling score. The question is about the canvas (did the press stay on the
|
|
8
|
-
* thing under it?), so it lives beside the hit-testing that answers the next
|
|
9
|
-
* question.
|
|
10
|
-
*
|
|
11
|
-
* ## Mouse and touch differ, on purpose
|
|
12
|
-
*
|
|
13
|
-
* A mouse is still: a click that moved more than 3px was meant to move, which
|
|
14
|
-
* is exactly where the web's box select has always started. A finger is not —
|
|
15
|
-
* a deliberate tap on a phone routinely lands several points from where it
|
|
16
|
-
* touched down, and holding a finger to 3px would turn a good share of taps
|
|
17
|
-
* into drags. So a touch gets `TOUCH_TAP_SLOP`, the same allowance a long press
|
|
18
|
-
* already had: a press that stays put long enough to be a long press would
|
|
19
|
-
* otherwise have been a *drag* had it been released a moment sooner, which is
|
|
20
|
-
* not a distinction a thumb can make.
|
|
21
|
-
*
|
|
22
|
-
* A mouse never long-presses. It has a secondary button for the context menu,
|
|
23
|
-
* and a click held while the reader looks at something is not a request for
|
|
24
|
-
* one — reading it as one would change what an ordinary slow click does on the
|
|
25
|
-
* web. React Native on macOS passes `'touch'`, because its gesture model is the
|
|
26
|
-
* touch one: the long press is how it opens the menu.
|
|
27
|
-
*
|
|
28
|
-
* ## Distance
|
|
29
|
-
*
|
|
30
|
-
* Measured per axis (the larger of |dx| and |dy|), which is the web's existing
|
|
31
|
-
* rule to the pixel. The native app used the straight-line distance; per axis
|
|
32
|
-
* lets a diagonal wander up to √2 further, which is under five points at a
|
|
33
|
-
* 12pt slop and not something a hand can aim at.
|
|
34
|
-
*
|
|
35
|
-
* The caller latches: once a press has classified as a drag it stays one even
|
|
36
|
-
* if the pointer comes back, which is how the web's `drag.moved` behaves. This
|
|
37
|
-
* function answers for one moment and keeps no state.
|
|
38
|
-
*/
|
|
39
|
-
/** How far a mouse press may move and still be a click, in px (web). */
|
|
40
|
-
export const TAP_SLOP = 3;
|
|
41
|
-
/** How far a finger may move and still be a tap, in pt. */
|
|
42
|
-
export const TOUCH_TAP_SLOP = 12;
|
|
43
|
-
/** How long a press is held to be a long press — iOS's and Android's own threshold. */
|
|
44
|
-
export const LONG_PRESS_MS = 500;
|
|
45
|
-
/** How far a long press may wander — about a thumb's width. */
|
|
46
|
-
export const LONG_PRESS_SLOP = 12;
|
|
47
|
-
/** The tap slop for a pointer kind. */
|
|
48
|
-
export function tapSlopFor(pointer) {
|
|
49
|
-
return pointer === 'touch' ? TOUCH_TAP_SLOP : TAP_SLOP;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* `'longPress'` if a touch was held `LONG_PRESS_MS` within `LONG_PRESS_SLOP`;
|
|
53
|
-
* otherwise `'tap'` if it moved no more than the tap slop; otherwise `'drag'`.
|
|
54
|
-
*/
|
|
55
|
-
export function classifyPress({ dx, dy, heldMs, pointer = 'mouse', }) {
|
|
56
|
-
const moved = Math.max(Math.abs(dx), Math.abs(dy));
|
|
57
|
-
if (pointer === 'touch' &&
|
|
58
|
-
heldMs >= LONG_PRESS_MS &&
|
|
59
|
-
moved <= LONG_PRESS_SLOP) {
|
|
60
|
-
return 'longPress';
|
|
61
|
-
}
|
|
62
|
-
return moved <= tapSlopFor(pointer) ? 'tap' : 'drag';
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=press.js.map
|
package/dist/press.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"press.js","sourceRoot":"","sources":["../src/press.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAOH,wEAAwE;AACxE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAE1B,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,uFAAuF;AACvF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,uCAAuC;AACvC,MAAM,UAAU,UAAU,CAAC,OAAoB;IAC7C,OAAO,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC;AACzD,CAAC;AAYD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,EAAE,EACF,EAAE,EACF,MAAM,EACN,OAAO,GAAG,OAAO,GACJ;IACb,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD,IACE,OAAO,KAAK,OAAO;QACnB,MAAM,IAAI,aAAa;QACvB,KAAK,IAAI,eAAe,EACxB,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AACvD,CAAC"}
|