@1337exp/taoux 0.0.0-stage → 0.1.0
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/CHANGELOG.md +27 -0
- package/LICENSE +21 -0
- package/README.md +137 -2
- package/README.ru.md +140 -0
- package/dist/camera.d.ts +22 -0
- package/dist/camera.js +38 -0
- package/dist/camera.js.map +1 -0
- package/dist/canvas/TaoxCanvas.vue.d.ts +37 -0
- package/dist/canvas/host.d.ts +138 -0
- package/dist/canvas/index.d.ts +3 -0
- package/dist/canvas/useCanvasGestures.d.ts +44 -0
- package/dist/canvas.css +55 -0
- package/dist/canvas.js +696 -0
- package/dist/canvas.js.map +1 -0
- package/dist/chunks/curveeditor-goX9maE5.js +759 -0
- package/dist/chunks/curveeditor-goX9maE5.js.map +1 -0
- package/dist/curve.d.ts +53 -0
- package/dist/curve.js +81 -0
- package/dist/curve.js.map +1 -0
- package/dist/curveeditor/TaoxCurveEditor.vue.d.ts +74 -0
- package/dist/curveeditor/index.d.ts +3 -0
- package/dist/curveeditor/ops.d.ts +63 -0
- package/dist/curveeditor.css +115 -0
- package/dist/curveeditor.js +1 -0
- package/dist/curvefield/TaoxCurveField.vue.d.ts +64 -0
- package/dist/curvefield/index.d.ts +2 -0
- package/dist/curvefield/labels.d.ts +13 -0
- package/dist/curvefield.css +57 -0
- package/dist/curvefield.js +252 -0
- package/dist/curvefield.js.map +1 -0
- package/dist/ease.d.ts +62 -0
- package/dist/ease.js +157 -0
- package/dist/ease.js.map +1 -0
- package/dist/edgescroll.d.ts +77 -0
- package/dist/edgescroll.js +78 -0
- package/dist/edgescroll.js.map +1 -0
- package/dist/file.d.ts +10 -0
- package/dist/file.js +22 -0
- package/dist/file.js.map +1 -0
- package/dist/gestures.d.ts +174 -0
- package/dist/gestures.js +229 -0
- package/dist/gestures.js.map +1 -0
- package/dist/gradienteditor/TaoxGradientEditor.vue.d.ts +48 -0
- package/dist/gradienteditor/index.d.ts +2 -0
- package/dist/gradienteditor/ops.d.ts +83 -0
- package/dist/gradienteditor.css +81 -0
- package/dist/gradienteditor.js +337 -0
- package/dist/gradienteditor.js.map +1 -0
- package/dist/history.d.ts +42 -0
- package/dist/history.js +89 -0
- package/dist/history.js.map +1 -0
- package/dist/i18n.d.ts +51 -0
- package/dist/i18n.js +102 -0
- package/dist/i18n.js.map +1 -0
- package/dist/ids.d.ts +5 -0
- package/dist/ids.js +17 -0
- package/dist/ids.js.map +1 -0
- package/dist/links/TaoxLinks.vue.d.ts +14 -0
- package/dist/links/index.d.ts +2 -0
- package/dist/links/types.d.ts +37 -0
- package/dist/links.css +80 -0
- package/dist/links.js +72 -0
- package/dist/links.js.map +1 -0
- package/dist/num.d.ts +35 -0
- package/dist/num.js +60 -0
- package/dist/num.js.map +1 -0
- package/dist/palette.d.ts +34 -0
- package/dist/palette.js +41 -0
- package/dist/palette.js.map +1 -0
- package/dist/pins.d.ts +66 -0
- package/dist/pins.js +83 -0
- package/dist/pins.js.map +1 -0
- package/dist/playback/core.d.ts +81 -0
- package/dist/playback/index.d.ts +2 -0
- package/dist/playback/use.d.ts +38 -0
- package/dist/playback.js +199 -0
- package/dist/playback.js.map +1 -0
- package/dist/session.d.ts +125 -0
- package/dist/session.js +195 -0
- package/dist/session.js.map +1 -0
- package/dist/snap.d.ts +24 -0
- package/dist/snap.js +34 -0
- package/dist/snap.js.map +1 -0
- package/dist/storage.d.ts +16 -0
- package/dist/storage.js +30 -0
- package/dist/storage.js.map +1 -0
- package/dist/touch.d.ts +9 -0
- package/dist/touch.js +20 -0
- package/dist/touch.js.map +1 -0
- package/dist/wheel.d.ts +31 -0
- package/dist/wheel.js +47 -0
- package/dist/wheel.js.map +1 -0
- package/package.json +183 -4
- package/theme/taoui.css +43 -0
package/dist/gestures.js
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
//#region src/gestures.ts
|
|
2
|
+
/**
|
|
3
|
+
* Recognition of touch gestures. Pure logic with no DOM and no timers: time and coordinates come from outside,
|
|
4
|
+
* so everything is covered by tests. Events and timers (long press) live in EditorCanvas.
|
|
5
|
+
* Распознавание сенсорных жестов. Чистая логика без DOM и таймеров: время и координаты приходят снаружи,
|
|
6
|
+
* поэтому всё проверяется тестами. События и таймеры (долгое нажатие) живут в EditorCanvas.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* By how many px a finger may move and still count as "standing still".
|
|
10
|
+
* На сколько px палец может сместиться и всё ещё считаться «стоящим на месте».
|
|
11
|
+
*/
|
|
12
|
+
var TAP_SLOP_PX = 8;
|
|
13
|
+
/**
|
|
14
|
+
* A touch longer than this is no longer a tap.
|
|
15
|
+
* Дольше этого касание уже не тап.
|
|
16
|
+
*/
|
|
17
|
+
var TAP_MAX_MS = 300;
|
|
18
|
+
/**
|
|
19
|
+
* How long the finger must be held still for a long press.
|
|
20
|
+
* Сколько надо держать палец неподвижно для долгого нажатия.
|
|
21
|
+
*/
|
|
22
|
+
var LONG_PRESS_MS = 500;
|
|
23
|
+
/**
|
|
24
|
+
* The second tap must come no later and no further than this from the first.
|
|
25
|
+
* Второй тап должен прийти не позже и не дальше этого от первого.
|
|
26
|
+
*/
|
|
27
|
+
var DOUBLE_TAP_MS = 300;
|
|
28
|
+
var DOUBLE_TAP_RADIUS_PX = 30;
|
|
29
|
+
var dist = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
|
|
30
|
+
/**
|
|
31
|
+
* Parses a one-finger touch: tap, double tap, movement, readiness of a long press.
|
|
32
|
+
* Разбирает касание одним пальцем: тап, двойной тап, сдвиг, готовность долгого нажатия.
|
|
33
|
+
*/
|
|
34
|
+
var TapRecognizer = class {
|
|
35
|
+
start = null;
|
|
36
|
+
moved = false;
|
|
37
|
+
lastTap = null;
|
|
38
|
+
doubleDown = false;
|
|
39
|
+
/**
|
|
40
|
+
* The finger landed. Returns true if this is the second touch of a double tap (it is not finished yet:
|
|
41
|
+
* a drag may follow, as in "double tap and drag").
|
|
42
|
+
* Палец лёг. Возвращает true, если это второе касание двойного тапа (оно ещё не закончено:
|
|
43
|
+
* дальше может быть протяжка, как «двойной тап и тянуть»).
|
|
44
|
+
*/
|
|
45
|
+
down(s) {
|
|
46
|
+
this.start = s;
|
|
47
|
+
this.moved = false;
|
|
48
|
+
const prev = this.lastTap;
|
|
49
|
+
this.doubleDown = prev !== null && s.t - prev.t <= 300 && dist(s, prev) <= 30;
|
|
50
|
+
return this.doubleDown;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The finger moved. Returns true if it already left the slop (neither a tap nor a long press).
|
|
54
|
+
* Палец сдвинулся. Возвращает true, если он уже ушёл дальше допуска (не тап и не долгое нажатие).
|
|
55
|
+
*/
|
|
56
|
+
move(s) {
|
|
57
|
+
if (this.start && !this.moved && dist(s, this.start) > 8) this.moved = true;
|
|
58
|
+
return this.moved;
|
|
59
|
+
}
|
|
60
|
+
get isMoved() {
|
|
61
|
+
return this.moved;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Whether it is time to count the touch as a long press: the finger lies still longer than `LONG_PRESS_MS`.
|
|
65
|
+
* Пора ли считать касание долгим нажатием: палец лежит на месте дольше `LONG_PRESS_MS`.
|
|
66
|
+
*/
|
|
67
|
+
longPressDue(now) {
|
|
68
|
+
return this.start !== null && !this.moved && now - this.start.t >= 500;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The finger was lifted: what that was. After `double` the next tap counts as single again.
|
|
72
|
+
* Палец поднят: что это было. После `double` следующий тап снова считается одиночным.
|
|
73
|
+
*/
|
|
74
|
+
up(s) {
|
|
75
|
+
const start = this.start;
|
|
76
|
+
this.start = null;
|
|
77
|
+
if (!start) return null;
|
|
78
|
+
this.move(s);
|
|
79
|
+
if (this.moved || s.t - start.t > 300) {
|
|
80
|
+
this.lastTap = null;
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
if (this.doubleDown) {
|
|
84
|
+
this.lastTap = null;
|
|
85
|
+
return "double";
|
|
86
|
+
}
|
|
87
|
+
this.lastTap = s;
|
|
88
|
+
return "tap";
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The gesture turned out to be something else (a long press, a pinch, an interruption): forget both the current touch and the previous tap.
|
|
92
|
+
* Жест оказался чем-то другим (долгое нажатие, щипок, прерывание): забываем и текущее касание, и предыдущий тап.
|
|
93
|
+
*/
|
|
94
|
+
cancel() {
|
|
95
|
+
this.start = null;
|
|
96
|
+
this.lastTap = null;
|
|
97
|
+
this.doubleDown = false;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
function pinchOf(a, b) {
|
|
101
|
+
if (!b) return {
|
|
102
|
+
cx: a.x,
|
|
103
|
+
cy: a.y,
|
|
104
|
+
dist: 0
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
cx: (a.x + b.x) / 2,
|
|
108
|
+
cy: (a.y + b.y) / 2,
|
|
109
|
+
dist: dist(a, b)
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Until the distance between the fingers has changed by this much, the gesture counts as a plain shift: the scale is not touched.
|
|
114
|
+
* Пока расстояние между пальцами не изменилось на столько, жест считается просто сдвигом: масштаб не трогаем.
|
|
115
|
+
*/
|
|
116
|
+
var PINCH_ENGAGE_PX = 20;
|
|
117
|
+
/**
|
|
118
|
+
* Distance changes smaller than this count as finger jitter and are ignored.
|
|
119
|
+
* Изменения расстояния мельче этого считаем дрожанием пальцев и игнорируем.
|
|
120
|
+
*/
|
|
121
|
+
var PINCH_DEADBAND_PX = 1.5;
|
|
122
|
+
/**
|
|
123
|
+
* How many last steps we look at when deciding "shifting or scaling".
|
|
124
|
+
* Сколько последних шагов смотрим, решая «сдвигают или масштабируют».
|
|
125
|
+
*/
|
|
126
|
+
var PINCH_WINDOW = 6;
|
|
127
|
+
/**
|
|
128
|
+
* To turn the scale on, the distance over the window must change at least as much as the centre moves, and at least this much.
|
|
129
|
+
* Для включения масштаба расстояние за окно должно меняться не меньше, чем сдвигается центр, и не меньше этого.
|
|
130
|
+
*/
|
|
131
|
+
var PINCH_DOMINANCE = 1;
|
|
132
|
+
var PINCH_MIN_NET_PX = 4;
|
|
133
|
+
/**
|
|
134
|
+
* The scale turns off again when the centre moves this many times further than the distance changes over the window (and at least `PINCH_RELEASE_MIN_PX`).
|
|
135
|
+
* Масштаб выключается обратно, когда центр за окно уходит в столько раз дальше, чем меняется расстояние (и не меньше `PINCH_RELEASE_MIN_PX`).
|
|
136
|
+
*/
|
|
137
|
+
var PINCH_RELEASE_RATIO = 2;
|
|
138
|
+
var PINCH_RELEASE_MIN_PX = 12;
|
|
139
|
+
/**
|
|
140
|
+
* A two-finger gesture: shift and/or scale. The scale is the ratio of distances, and the distance between the fingers
|
|
141
|
+
* drifts during an ordinary two-finger shift too, so it cannot be applied just like that.
|
|
142
|
+
* Жест двумя пальцами: сдвиг и/или масштаб. Масштаб считается как отношение расстояний, а расстояние между
|
|
143
|
+
* пальцами при обычном сдвиге двумя пальцами тоже «плывёт», поэтому его нельзя применять просто так.
|
|
144
|
+
*
|
|
145
|
+
* - The distance must change deliberately (`PINCH_ENGAGE_PX`), not build up by drift.
|
|
146
|
+
* - Over the last `PINCH_WINDOW` steps the distance must change more than the centre moves:
|
|
147
|
+
* while the fingers are carried together, the scale does not turn on however the distance floats. We look at the signed sum:
|
|
148
|
+
* the browser sends finger movement one at a time, and "one moved, the other caught up" cancels out.
|
|
149
|
+
* - Once the scale is on there is no jump (counting is from the current distance), and small jitter is cut by a
|
|
150
|
+
* dead zone. If the fingers are then carried together, the scale turns off again.
|
|
151
|
+
* - Расстояние должно измениться осознанно (`PINCH_ENGAGE_PX`), а не накопиться дрейфом.
|
|
152
|
+
* - При этом за последние `PINCH_WINDOW` шагов расстояние должно меняться сильнее, чем сдвигается центр:
|
|
153
|
+
* пока пальцы везут вместе, масштаб не включается, как бы расстояние ни плавало. Смотрим на сумму со знаком:
|
|
154
|
+
* браузер присылает движение пальцев по одному, и «один сдвинулся, второй догнал» взаимно сокращается.
|
|
155
|
+
* - Когда масштаб включился, скачка нет (отсчёт идёт от текущего расстояния), а мелкое дрожание отсекается
|
|
156
|
+
* мёртвой зоной. Если потом пальцы повезли вместе, масштаб выключается обратно.
|
|
157
|
+
*
|
|
158
|
+
* The centre shift always works.
|
|
159
|
+
* Сдвиг центра работает всегда.
|
|
160
|
+
*/
|
|
161
|
+
var PinchTracker = class {
|
|
162
|
+
prev = {
|
|
163
|
+
cx: 0,
|
|
164
|
+
cy: 0,
|
|
165
|
+
dist: 0
|
|
166
|
+
};
|
|
167
|
+
startDist = 0;
|
|
168
|
+
baseDist = 0;
|
|
169
|
+
engaged = false;
|
|
170
|
+
recent = [];
|
|
171
|
+
/**
|
|
172
|
+
* A new set of fingers (a gesture began or the number of fingers changed): count from scratch, there will be no jump.
|
|
173
|
+
* Новый набор пальцев (жест начался или число пальцев изменилось): отсчёт заново, скачка не будет.
|
|
174
|
+
*/
|
|
175
|
+
begin(p) {
|
|
176
|
+
this.prev = p;
|
|
177
|
+
this.startDist = p.dist;
|
|
178
|
+
this.baseDist = p.dist;
|
|
179
|
+
this.engaged = false;
|
|
180
|
+
this.recent = [];
|
|
181
|
+
}
|
|
182
|
+
get isZooming() {
|
|
183
|
+
return this.engaged;
|
|
184
|
+
}
|
|
185
|
+
update(next) {
|
|
186
|
+
const step = {
|
|
187
|
+
factor: 1,
|
|
188
|
+
pivot: [this.prev.cx, this.prev.cy],
|
|
189
|
+
pan: [next.cx - this.prev.cx, next.cy - this.prev.cy]
|
|
190
|
+
};
|
|
191
|
+
const twoFingers = this.startDist > 0 && next.dist > 0 && this.prev.dist > 0;
|
|
192
|
+
this.recent.push({
|
|
193
|
+
dx: step.pan[0],
|
|
194
|
+
dy: step.pan[1],
|
|
195
|
+
dd: twoFingers ? next.dist - this.prev.dist : 0
|
|
196
|
+
});
|
|
197
|
+
if (this.recent.length > 6) this.recent.shift();
|
|
198
|
+
this.prev = next;
|
|
199
|
+
if (!twoFingers) return step;
|
|
200
|
+
let sx = 0;
|
|
201
|
+
let sy = 0;
|
|
202
|
+
let sd = 0;
|
|
203
|
+
for (const d of this.recent) {
|
|
204
|
+
sx += d.dx;
|
|
205
|
+
sy += d.dy;
|
|
206
|
+
sd += d.dd;
|
|
207
|
+
}
|
|
208
|
+
const netCenter = Math.hypot(sx, sy);
|
|
209
|
+
const netDist = Math.abs(sd);
|
|
210
|
+
if (!this.engaged) {
|
|
211
|
+
if (Math.abs(next.dist - this.startDist) >= 20 && netDist >= 4 && netDist >= 1 * netCenter) {
|
|
212
|
+
this.engaged = true;
|
|
213
|
+
this.baseDist = next.dist;
|
|
214
|
+
}
|
|
215
|
+
} else if (netCenter >= 12 && netCenter >= 2 * netDist) {
|
|
216
|
+
this.engaged = false;
|
|
217
|
+
this.startDist = next.dist;
|
|
218
|
+
this.baseDist = next.dist;
|
|
219
|
+
} else if (Math.abs(next.dist - this.baseDist) >= 1.5) {
|
|
220
|
+
step.factor = next.dist / this.baseDist;
|
|
221
|
+
this.baseDist = next.dist;
|
|
222
|
+
}
|
|
223
|
+
return step;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
//#endregion
|
|
227
|
+
export { DOUBLE_TAP_MS, DOUBLE_TAP_RADIUS_PX, LONG_PRESS_MS, PINCH_DEADBAND_PX, PINCH_DOMINANCE, PINCH_ENGAGE_PX, PINCH_MIN_NET_PX, PINCH_RELEASE_MIN_PX, PINCH_RELEASE_RATIO, PINCH_WINDOW, PinchTracker, TAP_MAX_MS, TAP_SLOP_PX, TapRecognizer, pinchOf };
|
|
228
|
+
|
|
229
|
+
//# sourceMappingURL=gestures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gestures.js","names":[],"sources":["../src/gestures.ts"],"sourcesContent":["/**\n * Recognition of touch gestures. Pure logic with no DOM and no timers: time and coordinates come from outside,\n * so everything is covered by tests. Events and timers (long press) live in EditorCanvas.\n * Распознавание сенсорных жестов. Чистая логика без DOM и таймеров: время и координаты приходят снаружи,\n * поэтому всё проверяется тестами. События и таймеры (долгое нажатие) живут в EditorCanvas.\n */\n\n/**\n * By how many px a finger may move and still count as \"standing still\".\n * На сколько px палец может сместиться и всё ещё считаться «стоящим на месте».\n */\nexport const TAP_SLOP_PX = 8;\n/**\n * A touch longer than this is no longer a tap.\n * Дольше этого касание уже не тап.\n */\nexport const TAP_MAX_MS = 300;\n/**\n * How long the finger must be held still for a long press.\n * Сколько надо держать палец неподвижно для долгого нажатия.\n */\nexport const LONG_PRESS_MS = 500;\n/**\n * The second tap must come no later and no further than this from the first.\n * Второй тап должен прийти не позже и не дальше этого от первого.\n */\nexport const DOUBLE_TAP_MS = 300;\nexport const DOUBLE_TAP_RADIUS_PX = 30;\n\nexport interface Sample {\n x: number;\n y: number;\n /**\n * Time, ms (any monotonic scale).\n * Время, мс (любая монотонная шкала).\n */\n t: number;\n}\n\nconst dist = (a: { x: number; y: number }, b: { x: number; y: number }) => Math.hypot(a.x - b.x, a.y - b.y);\n\nexport type TapResult = 'tap' | 'double' | null;\n\n/**\n * Parses a one-finger touch: tap, double tap, movement, readiness of a long press.\n * Разбирает касание одним пальцем: тап, двойной тап, сдвиг, готовность долгого нажатия.\n */\nexport class TapRecognizer {\n private start: Sample | null = null;\n private moved = false;\n private lastTap: Sample | null = null;\n private doubleDown = false;\n\n /**\n * The finger landed. Returns true if this is the second touch of a double tap (it is not finished yet:\n * a drag may follow, as in \"double tap and drag\").\n * Палец лёг. Возвращает true, если это второе касание двойного тапа (оно ещё не закончено:\n * дальше может быть протяжка, как «двойной тап и тянуть»).\n */\n down(s: Sample): boolean {\n this.start = s;\n this.moved = false;\n const prev = this.lastTap;\n this.doubleDown = prev !== null && s.t - prev.t <= DOUBLE_TAP_MS && dist(s, prev) <= DOUBLE_TAP_RADIUS_PX;\n return this.doubleDown;\n }\n\n /**\n * The finger moved. Returns true if it already left the slop (neither a tap nor a long press).\n * Палец сдвинулся. Возвращает true, если он уже ушёл дальше допуска (не тап и не долгое нажатие).\n */\n move(s: Sample): boolean {\n if (this.start && !this.moved && dist(s, this.start) > TAP_SLOP_PX) this.moved = true;\n return this.moved;\n }\n\n get isMoved(): boolean {\n return this.moved;\n }\n\n /**\n * Whether it is time to count the touch as a long press: the finger lies still longer than `LONG_PRESS_MS`.\n * Пора ли считать касание долгим нажатием: палец лежит на месте дольше `LONG_PRESS_MS`.\n */\n longPressDue(now: number): boolean {\n return this.start !== null && !this.moved && now - this.start.t >= LONG_PRESS_MS;\n }\n\n /**\n * The finger was lifted: what that was. After `double` the next tap counts as single again.\n * Палец поднят: что это было. После `double` следующий тап снова считается одиночным.\n */\n up(s: Sample): TapResult {\n const start = this.start;\n this.start = null;\n if (!start) return null;\n\n this.move(s);\n if (this.moved || s.t - start.t > TAP_MAX_MS) {\n this.lastTap = null;\n return null;\n }\n if (this.doubleDown) {\n this.lastTap = null;\n return 'double';\n }\n this.lastTap = s;\n return 'tap';\n }\n\n /**\n * The gesture turned out to be something else (a long press, a pinch, an interruption): forget both the current touch and the previous tap.\n * Жест оказался чем-то другим (долгое нажатие, щипок, прерывание): забываем и текущее касание, и предыдущий тап.\n */\n cancel(): void {\n this.start = null;\n this.lastTap = null;\n this.doubleDown = false;\n }\n}\n\n//--------------------------------------------------\n// Pinch and a two-finger gesture\n// Щипок и жест двумя пальцами\n\ntype Point = { x: number; y: number };\n\nexport interface Pinch {\n /**\n * The centre between the fingers.\n * Центр между пальцами.\n */\n cx: number;\n cy: number;\n /**\n * The distance between the fingers; 0 if there is one finger (then only a shift).\n * Расстояние между пальцами; 0, если палец один (тогда только сдвиг).\n */\n dist: number;\n}\n\nexport function pinchOf(a: Point, b?: Point): Pinch {\n if (!b) return { cx: a.x, cy: a.y, dist: 0 };\n return { cx: (a.x + b.x) / 2, cy: (a.y + b.y) / 2, dist: dist(a, b) };\n}\n\nexport interface PinchStep {\n /**\n * By how many times to change the scale.\n * Во сколько раз изменить масштаб.\n */\n factor: number;\n /**\n * Around which point (the centre before the step).\n * Вокруг какой точки (центр до шага).\n */\n pivot: [number, number];\n /**\n * By how much to shift the camera after the scale.\n * На сколько сдвинуть камеру после масштаба.\n */\n pan: [number, number];\n}\n\n/**\n * Until the distance between the fingers has changed by this much, the gesture counts as a plain shift: the scale is not touched.\n * Пока расстояние между пальцами не изменилось на столько, жест считается просто сдвигом: масштаб не трогаем.\n */\nexport const PINCH_ENGAGE_PX = 20;\n/**\n * Distance changes smaller than this count as finger jitter and are ignored.\n * Изменения расстояния мельче этого считаем дрожанием пальцев и игнорируем.\n */\nexport const PINCH_DEADBAND_PX = 1.5;\n/**\n * How many last steps we look at when deciding \"shifting or scaling\".\n * Сколько последних шагов смотрим, решая «сдвигают или масштабируют».\n */\nexport const PINCH_WINDOW = 6;\n/**\n * To turn the scale on, the distance over the window must change at least as much as the centre moves, and at least this much.\n * Для включения масштаба расстояние за окно должно меняться не меньше, чем сдвигается центр, и не меньше этого.\n */\nexport const PINCH_DOMINANCE = 1;\nexport const PINCH_MIN_NET_PX = 4;\n/**\n * The scale turns off again when the centre moves this many times further than the distance changes over the window (and at least `PINCH_RELEASE_MIN_PX`).\n * Масштаб выключается обратно, когда центр за окно уходит в столько раз дальше, чем меняется расстояние (и не меньше `PINCH_RELEASE_MIN_PX`).\n */\nexport const PINCH_RELEASE_RATIO = 2;\nexport const PINCH_RELEASE_MIN_PX = 12;\n\ninterface PinchDelta {\n dx: number;\n dy: number;\n dd: number;\n}\n\n/**\n * A two-finger gesture: shift and/or scale. The scale is the ratio of distances, and the distance between the fingers\n * drifts during an ordinary two-finger shift too, so it cannot be applied just like that.\n * Жест двумя пальцами: сдвиг и/или масштаб. Масштаб считается как отношение расстояний, а расстояние между\n * пальцами при обычном сдвиге двумя пальцами тоже «плывёт», поэтому его нельзя применять просто так.\n *\n * - The distance must change deliberately (`PINCH_ENGAGE_PX`), not build up by drift.\n * - Over the last `PINCH_WINDOW` steps the distance must change more than the centre moves:\n * while the fingers are carried together, the scale does not turn on however the distance floats. We look at the signed sum:\n * the browser sends finger movement one at a time, and \"one moved, the other caught up\" cancels out.\n * - Once the scale is on there is no jump (counting is from the current distance), and small jitter is cut by a\n * dead zone. If the fingers are then carried together, the scale turns off again.\n * - Расстояние должно измениться осознанно (`PINCH_ENGAGE_PX`), а не накопиться дрейфом.\n * - При этом за последние `PINCH_WINDOW` шагов расстояние должно меняться сильнее, чем сдвигается центр:\n * пока пальцы везут вместе, масштаб не включается, как бы расстояние ни плавало. Смотрим на сумму со знаком:\n * браузер присылает движение пальцев по одному, и «один сдвинулся, второй догнал» взаимно сокращается.\n * - Когда масштаб включился, скачка нет (отсчёт идёт от текущего расстояния), а мелкое дрожание отсекается\n * мёртвой зоной. Если потом пальцы повезли вместе, масштаб выключается обратно.\n *\n * The centre shift always works.\n * Сдвиг центра работает всегда.\n */\nexport class PinchTracker {\n private prev: Pinch = { cx: 0, cy: 0, dist: 0 };\n private startDist = 0;\n private baseDist = 0;\n private engaged = false;\n private recent: PinchDelta[] = [];\n\n /**\n * A new set of fingers (a gesture began or the number of fingers changed): count from scratch, there will be no jump.\n * Новый набор пальцев (жест начался или число пальцев изменилось): отсчёт заново, скачка не будет.\n */\n begin(p: Pinch): void {\n this.prev = p;\n this.startDist = p.dist;\n this.baseDist = p.dist;\n this.engaged = false;\n this.recent = [];\n }\n\n get isZooming(): boolean {\n return this.engaged;\n }\n\n update(next: Pinch): PinchStep {\n const step: PinchStep = {\n factor: 1,\n pivot: [this.prev.cx, this.prev.cy],\n pan: [next.cx - this.prev.cx, next.cy - this.prev.cy],\n };\n\n // With one finger (the distance is 0 either way) there is no scale.\n // С одним пальцем (расстояние 0 с любой стороны) масштаба нет.\n const twoFingers = this.startDist > 0 && next.dist > 0 && this.prev.dist > 0;\n this.recent.push({ dx: step.pan[0], dy: step.pan[1], dd: twoFingers ? next.dist - this.prev.dist : 0 });\n if (this.recent.length > PINCH_WINDOW) this.recent.shift();\n this.prev = next;\n if (!twoFingers) return step;\n\n let sx = 0;\n let sy = 0;\n let sd = 0;\n for (const d of this.recent) {\n sx += d.dx;\n sy += d.dy;\n sd += d.dd;\n }\n const netCenter = Math.hypot(sx, sy);\n const netDist = Math.abs(sd);\n\n if (!this.engaged) {\n const intentional = Math.abs(next.dist - this.startDist) >= PINCH_ENGAGE_PX;\n if (intentional && netDist >= PINCH_MIN_NET_PX && netDist >= PINCH_DOMINANCE * netCenter) {\n this.engaged = true;\n this.baseDist = next.dist; // counted from this moment: no jump / отсчёт с этого момента: без скачка\n }\n } else if (netCenter >= PINCH_RELEASE_MIN_PX && netCenter >= PINCH_RELEASE_RATIO * netDist) {\n // The fingers were carried together: the scale turns off, the new threshold is counted from the current distance.\n // Пальцы повезли вместе: масштаб выключаем, новый порог отсчитываем от нынешнего расстояния.\n this.engaged = false;\n this.startDist = next.dist;\n this.baseDist = next.dist;\n } else if (Math.abs(next.dist - this.baseDist) >= PINCH_DEADBAND_PX) {\n step.factor = next.dist / this.baseDist;\n this.baseDist = next.dist;\n }\n return step;\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type GradientStop } from './ops';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Stops in ascending t (at least one).
|
|
5
|
+
* Остановки по возрастанию t (минимум одна).
|
|
6
|
+
*/
|
|
7
|
+
modelValue: readonly GradientStop[];
|
|
8
|
+
/**
|
|
9
|
+
* Index of the selected stop.
|
|
10
|
+
* Индекс выбранной остановки.
|
|
11
|
+
*/
|
|
12
|
+
selected?: number;
|
|
13
|
+
/**
|
|
14
|
+
* A hint on hover over the bar.
|
|
15
|
+
* Подсказка при наведении на полосу.
|
|
16
|
+
*/
|
|
17
|
+
hint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Decimals of t and opacity in what the component emits; `null` does not round. Three by default; the colour components get two more.
|
|
20
|
+
* Знаков после запятой у t и непрозрачности в том, что компонент отдаёт; `null` не обрезает. По умолчанию три; компоненты цвета получают на два знака больше.
|
|
21
|
+
*/
|
|
22
|
+
precision?: number | null;
|
|
23
|
+
/**
|
|
24
|
+
* The keyboard arrow step along t (Shift: 10 times larger).
|
|
25
|
+
* Шаг стрелки с клавиатуры по t (Shift: в 10 раз крупнее).
|
|
26
|
+
*/
|
|
27
|
+
keyStep?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The stop label for screen readers; "Stop 1" by default.
|
|
30
|
+
* Подпись остановки для скринридеров; по умолчанию «Stop 1».
|
|
31
|
+
*/
|
|
32
|
+
stopLabel?: (index: number, stop: GradientStop) => string;
|
|
33
|
+
};
|
|
34
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
35
|
+
"update:modelValue": (value: GradientStop[]) => any;
|
|
36
|
+
"update:selected": (index: number) => any;
|
|
37
|
+
commit: () => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
39
|
+
"onUpdate:modelValue"?: ((value: GradientStop[]) => any) | undefined;
|
|
40
|
+
"onUpdate:selected"?: ((index: number) => any) | undefined;
|
|
41
|
+
onCommit?: (() => any) | undefined;
|
|
42
|
+
}>, {
|
|
43
|
+
selected: number;
|
|
44
|
+
precision: number | null;
|
|
45
|
+
keyStep: number;
|
|
46
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
47
|
+
declare const _default: typeof __VLS_export;
|
|
48
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { default as TaoxGradientEditor } from './TaoxGradientEditor.vue';
|
|
2
|
+
export { addStop, colorDigits, DEFAULT_PRECISION, gradientCss, moveStop, patchStop, pickFromStack, removeStop, roundAlpha, sampleGradient, stackAround, toLinear, toSrgb, type GradientStop } from './ops';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A gradient stop: t in 0…1, colour in linear RGB 0…1 (not sRGB), alpha 0…1.
|
|
3
|
+
* Linear colour is what rendering needs; for the CSS preview bar it is converted to sRGB (`gradientCss`).
|
|
4
|
+
* Остановка градиента: t в 0…1, цвет в линейном RGB 0…1 (не sRGB), alpha 0…1.
|
|
5
|
+
* Линейный цвет нужен рендеру; в CSS-полоску он переводится в sRGB (`gradientCss`).
|
|
6
|
+
*/
|
|
7
|
+
export interface GradientStop {
|
|
8
|
+
t: number;
|
|
9
|
+
color: [number, number, number];
|
|
10
|
+
alpha: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Default decimals of t and opacity: "0.5700000000000001" in a file is of use to nobody.
|
|
14
|
+
* Знаков после запятой по умолчанию у t и непрозрачности: «0.5700000000000001» в файле никому не нужно.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_PRECISION = 3;
|
|
17
|
+
/**
|
|
18
|
+
* Decimals of the colour components for a given `precision` of t and opacity. The colour is linear, and in the dark part of the scale sRGB rises steeply
|
|
19
|
+
* (a linear step of 0.001 is 3 levels out of 255), so two more decimals are needed here: five when t has three.
|
|
20
|
+
* Знаков у компонент цвета при `precision` у t и непрозрачности. Цвет линейный, а в тёмной части шкалы sRGB круто растёт
|
|
21
|
+
* (шаг 0.001 линейного это 3 уровня из 255), поэтому тут нужно на два знака больше: при трёх у t это пять.
|
|
22
|
+
*/
|
|
23
|
+
export declare const colorDigits: (precision: number | null) => number | null;
|
|
24
|
+
/**
|
|
25
|
+
* Opacity 0…1 with `digits` decimals (three by default).
|
|
26
|
+
* Непрозрачность 0…1 с `digits` знаками (по умолчанию три).
|
|
27
|
+
*/
|
|
28
|
+
export declare const roundAlpha: (a: number, digits?: number | null) => number;
|
|
29
|
+
/**
|
|
30
|
+
* Changes stop `i`; t and opacity are rounded to `precision` decimals (three by default; `null` turns it off), the colour to `precision + 2`.
|
|
31
|
+
* Меняет остановку `i`; t и непрозрачность округляются до `precision` знаков (по умолчанию три; `null` отключает), цвет до `precision + 2`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function patchStop(stops: readonly GradientStop[], i: number, patch: Partial<GradientStop>, precision?: number | null): GradientStop[];
|
|
34
|
+
/**
|
|
35
|
+
* The colour and opacity of the gradient at t: linear between stops, equal to the end stop beyond the ends. Returns [r, g, b, a].
|
|
36
|
+
* Цвет и непрозрачность градиента в t: линейно между остановками, за краями равны крайней. Возвращает [r, g, b, a].
|
|
37
|
+
*/
|
|
38
|
+
export declare function sampleGradient(stops: readonly GradientStop[], t: number): [number, number, number, number];
|
|
39
|
+
/**
|
|
40
|
+
* Moves stop `i` along t within its neighbours.
|
|
41
|
+
* Сдвигает остановку `i` по t в пределах соседей.
|
|
42
|
+
*/
|
|
43
|
+
export declare function moveStop(stops: readonly GradientStop[], i: number, t: number, precision?: number | null): GradientStop[];
|
|
44
|
+
/**
|
|
45
|
+
* Adds a stop at `t` with the colour the gradient has at that point; returns the new list and the index.
|
|
46
|
+
* Добавляет остановку в `t` с цветом, который градиент имеет в этой точке; возвращает новый список и индекс.
|
|
47
|
+
*/
|
|
48
|
+
export declare function addStop(stops: readonly GradientStop[], t: number, precision?: number | null): {
|
|
49
|
+
stops: GradientStop[];
|
|
50
|
+
index: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Removes a stop; the last one is never removed.
|
|
54
|
+
* Убирает остановку; последнюю не убирает.
|
|
55
|
+
*/
|
|
56
|
+
export declare function removeStop(stops: readonly GradientStop[], i: number): GradientStop[];
|
|
57
|
+
/**
|
|
58
|
+
* Stops lying right next to stop `i` (within `px` pixels at bar width `width`), itself included: a pile of overlapping handles.
|
|
59
|
+
* Остановки, лежащие вплотную к остановке `i` (в пределах `px` пикселей при ширине полосы `width`), включая её саму: стопка наложенных ручек.
|
|
60
|
+
*/
|
|
61
|
+
export declare function stackAround(stops: readonly GradientStop[], i: number, width: number, px: number): number[];
|
|
62
|
+
/**
|
|
63
|
+
* Which handle of the pile to take when it was dragged by `dx` pixels. The order of stops must not change, so only an outer one can be pulled out:
|
|
64
|
+
* the first to the left, the last to the right.
|
|
65
|
+
* Какую ручку из стопки взять, когда её потянули на `dx` пикселей. Порядок остановок менять нельзя, поэтому вытянуть можно
|
|
66
|
+
* только крайнюю: влево первую, вправо последнюю.
|
|
67
|
+
*/
|
|
68
|
+
export declare function pickFromStack(cluster: readonly number[], dx: number): number;
|
|
69
|
+
/**
|
|
70
|
+
* Linear colour → sRGB, 0…1.
|
|
71
|
+
* Линейный цвет → sRGB, 0…1.
|
|
72
|
+
*/
|
|
73
|
+
export declare const toSrgb: (c: number) => number;
|
|
74
|
+
/**
|
|
75
|
+
* sRGB → linear colour, 0…1.
|
|
76
|
+
* sRGB → линейный цвет, 0…1.
|
|
77
|
+
*/
|
|
78
|
+
export declare const toLinear: (c: number) => number;
|
|
79
|
+
/**
|
|
80
|
+
* A CSS gradient for the preview bar (linear colour is converted to sRGB, alpha stays).
|
|
81
|
+
* CSS-градиент для полосы предпросмотра (линейный цвет переводится в sRGB, альфа остаётся).
|
|
82
|
+
*/
|
|
83
|
+
export declare function gradientCss(stops: readonly GradientStop[]): string;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* Configured with CSS variables on any ancestor:
|
|
4
|
+
* Настройка через CSS-переменные на любом предке:
|
|
5
|
+
* --tx-gradient-border, --tx-gradient-stop-border, --tx-gradient-stop-outline, --tx-gradient-accent.
|
|
6
|
+
*/
|
|
7
|
+
.tx-gradient {
|
|
8
|
+
position: relative;
|
|
9
|
+
height: 22px;
|
|
10
|
+
margin-bottom: 20px; /* room for the stop handles and the mark of the selected one / место под ручки остановок и отметку выбранной */
|
|
11
|
+
border: 1px solid var(--tx-gradient-border, #2a2d33);
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
/* a checkerboard under the bar shows transparency / шахматка под полосой показывает прозрачность */
|
|
14
|
+
background-color: #fff;
|
|
15
|
+
background-size: 100% 100%, 12px 12px;
|
|
16
|
+
cursor: crosshair;
|
|
17
|
+
}
|
|
18
|
+
.tx-gradient-stop {
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: calc(100% - 2px);
|
|
21
|
+
width: 14px;
|
|
22
|
+
height: 14px;
|
|
23
|
+
margin-left: -7px;
|
|
24
|
+
cursor: grab;
|
|
25
|
+
}
|
|
26
|
+
.tx-gradient-stop:active {
|
|
27
|
+
cursor: grabbing;
|
|
28
|
+
}
|
|
29
|
+
.tx-gradient-stop:focus {
|
|
30
|
+
outline: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* keyboard focus: a glow of the accent colour around the triangle / фокус с клавиатуры: свечение акцентного цвета вокруг треугольника */
|
|
34
|
+
.tx-gradient-stop:focus-visible svg {
|
|
35
|
+
filter: drop-shadow(0 0 3px var(--tx-gradient-accent, #4fc3f7));
|
|
36
|
+
}
|
|
37
|
+
.tx-gradient-stop svg {
|
|
38
|
+
display: block;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
overflow: visible;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* a dark 1px outline outside the main one: the handle is visible on light bar colours behind it too / тёмная обводка в 1px снаружи основной: ручка видна и на светлых цветах полосы за ней */
|
|
45
|
+
.tx-gradient-stop .tx-gradient-halo {
|
|
46
|
+
fill: none;
|
|
47
|
+
stroke: var(--tx-gradient-stop-outline, rgba(0, 0, 0, 0.85));
|
|
48
|
+
stroke-width: 3.5;
|
|
49
|
+
stroke-linejoin: round;
|
|
50
|
+
}
|
|
51
|
+
.tx-gradient-stop polygon:not(.tx-gradient-halo) {
|
|
52
|
+
fill: currentColor; /* the stop colour is set by the component itself / цвет остановки задаёт сам компонент */
|
|
53
|
+
stroke: var(--tx-gradient-stop-border, #5a606b);
|
|
54
|
+
stroke-width: 1.5;
|
|
55
|
+
stroke-linejoin: round;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
* The selected handle: above the others (not hidden in a pile), slightly larger and with an accent stroke under it.
|
|
60
|
+
* The fill stays the stop colour: the accent must not argue with it, so the outline is not coloured.
|
|
61
|
+
* Выбранная ручка: выше остальных (в стопке не прячется), чуть крупнее и с акцентной черточкой под ней.
|
|
62
|
+
* Заливка остаётся цветом остановки: акцент не должен спорить с ним, поэтому обводку не красим.
|
|
63
|
+
*/
|
|
64
|
+
.tx-gradient-stop.on {
|
|
65
|
+
z-index: 1;
|
|
66
|
+
}
|
|
67
|
+
.tx-gradient-stop.on svg {
|
|
68
|
+
transform: scale(1.25);
|
|
69
|
+
transform-origin: 50% 0;
|
|
70
|
+
}
|
|
71
|
+
.tx-gradient-stop.on::after {
|
|
72
|
+
content: '';
|
|
73
|
+
position: absolute;
|
|
74
|
+
bottom: -6px;
|
|
75
|
+
left: 50%;
|
|
76
|
+
width: 12px;
|
|
77
|
+
height: 2px;
|
|
78
|
+
margin-left: -6px;
|
|
79
|
+
border-radius: 1px;
|
|
80
|
+
background: var(--tx-gradient-accent, #4fc3f7);
|
|
81
|
+
}
|