panelui-native 0.109.0 → 0.111.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.
@@ -0,0 +1,360 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The geometry behind the avatar cropper, kept apart from the component.
5
+ *
6
+ * The mask stays fixed in the middle of the canvas and the photo moves under
7
+ * it, so everything here is one question asked different ways: where is the
8
+ * mask, measured in the photo's own frame? Clamping asks it to keep the mask
9
+ * on the photo — or, when the photo may be smaller than the mask, the photo
10
+ * inside the mask — and the export asks it to find the same square in the
11
+ * photo's pixels.
12
+ *
13
+ * The photo is drawn at a base size whose short side equals the mask, then
14
+ * moved by `x`/`y`, turned by `rotation` and scaled by `scale` about its own
15
+ * centre — the order React Native applies `translate`, `rotate`, `scale` in a
16
+ * transform. Every function runs on the UI thread inside a gesture or an
17
+ * animated style, so each is a worklet, and none touches React Native, which
18
+ * is what lets the contract tests run them in Node.
19
+ */
20
+
21
+ /** Where the photo sits under the mask. Rotation is in degrees, clockwise. */
22
+
23
+ /** The fixed parts: the mask's side, and the photo's size at a scale of 1. */
24
+
25
+ /** A crop in the source's pixels, after the source is turned by `rotation`. */
26
+
27
+ export const IDENTITY = {
28
+ x: 0,
29
+ y: 0,
30
+ scale: 1,
31
+ rotation: 0
32
+ };
33
+
34
+ /** How much a rubber-banded overshoot gives. Lower is stiffer. */
35
+ const RUBBER_BAND = 0.55;
36
+
37
+ /** Below this a sine or cosine is taken as zero, so a quarter turn is exact. */
38
+ const EPSILON = 1e-9;
39
+ export function clamp(value, min, max) {
40
+ 'worklet';
41
+
42
+ return Math.min(Math.max(value, min), max);
43
+ }
44
+ function trig(degrees) {
45
+ 'worklet';
46
+
47
+ const radians = degrees * Math.PI / 180;
48
+ let cos = Math.cos(radians);
49
+ let sin = Math.sin(radians);
50
+ if (Math.abs(cos) < EPSILON) cos = 0;
51
+ if (Math.abs(sin) < EPSILON) sin = 0;
52
+ return {
53
+ cos,
54
+ sin
55
+ };
56
+ }
57
+
58
+ /** An angle folded into (-180, 180]. */
59
+ export function normalizeDegrees(degrees) {
60
+ 'worklet';
61
+
62
+ let folded = degrees % 360;
63
+ if (folded <= -180) folded += 360;
64
+ if (folded > 180) folded -= 360;
65
+ return folded;
66
+ }
67
+
68
+ /** The photo's size at a scale of 1: its short side exactly covers the mask. */
69
+ export function baseSize(source, mask) {
70
+ 'worklet';
71
+
72
+ const shortSide = Math.min(source.width, source.height);
73
+ if (shortSide <= 0 || mask <= 0) return {
74
+ width: mask,
75
+ height: mask
76
+ };
77
+ const factor = mask / shortSide;
78
+ return {
79
+ width: source.width * factor,
80
+ height: source.height * factor
81
+ };
82
+ }
83
+
84
+ /**
85
+ * Half the mask's extent along the photo's axes, in screen points.
86
+ *
87
+ * A circle reaches the same distance whichever way the photo is turned. A
88
+ * square turned against the photo reaches further — out to its corners — and
89
+ * the squircle is held to its square, which contains it, so its corners can
90
+ * never come off the photo either.
91
+ */
92
+ export function maskReach(shape, mask, rotation) {
93
+ 'worklet';
94
+
95
+ const half = mask / 2;
96
+ if (shape === 'circle') return half;
97
+ const {
98
+ cos,
99
+ sin
100
+ } = trig(rotation);
101
+ return half * (Math.abs(cos) + Math.abs(sin));
102
+ }
103
+
104
+ /**
105
+ * The limits a crop is held to.
106
+ *
107
+ * With `cover` on, the photo always fills the mask. With it off, the photo may
108
+ * also be smaller than the mask, down to `minZoom` — its long side as a
109
+ * fraction of the mask's — and a smaller photo is kept inside the mask rather
110
+ * than on it.
111
+ */
112
+
113
+ /** The smallest scale the photo may settle at. */
114
+ export function minScale(bounds, frame, rotation) {
115
+ 'worklet';
116
+
117
+ // The base size's short side is the mask, so covering the reach on the
118
+ // short side covers it on the long one too.
119
+ const covering = maskReach(bounds.shape, 2, rotation);
120
+ if (bounds.cover) return covering;
121
+ const longSide = Math.max(frame.image.width, frame.image.height);
122
+ if (longSide <= 0) return covering;
123
+ return Math.min(covering, bounds.minZoom * frame.mask / longSide);
124
+ }
125
+
126
+ /** Screen offset → the same offset along the photo's axes, and back. */
127
+ function toImageAxes(x, y, rotation) {
128
+ 'worklet';
129
+
130
+ const {
131
+ cos,
132
+ sin
133
+ } = trig(rotation);
134
+ return {
135
+ u: cos * x + sin * y,
136
+ v: -sin * x + cos * y
137
+ };
138
+ }
139
+ function fromImageAxes(u, v, rotation) {
140
+ 'worklet';
141
+
142
+ const {
143
+ cos,
144
+ sin
145
+ } = trig(rotation);
146
+ return {
147
+ x: cos * u - sin * v,
148
+ y: sin * u + cos * v
149
+ };
150
+ }
151
+
152
+ /**
153
+ * How far the photo can move along each of its own axes.
154
+ *
155
+ * On an axis where the photo is larger than the mask's reach, the mask has to
156
+ * stay on the photo. On one where it is smaller — only possible with `cover`
157
+ * off — the photo has to stay inside the reach instead. Both are the gap
158
+ * between the two half-lengths, which is why one expression covers both.
159
+ */
160
+ function travel(state, bounds, frame) {
161
+ 'worklet';
162
+
163
+ const reach = maskReach(bounds.shape, frame.mask, state.rotation);
164
+ const u = state.scale * frame.image.width / 2 - reach;
165
+ const v = state.scale * frame.image.height / 2 - reach;
166
+ return bounds.cover ? {
167
+ u: Math.max(0, u),
168
+ v: Math.max(0, v)
169
+ } : {
170
+ u: Math.abs(u),
171
+ v: Math.abs(v)
172
+ };
173
+ }
174
+
175
+ /** The nearest translation inside the bounds. */
176
+ export function clampTranslation(state, bounds, frame) {
177
+ 'worklet';
178
+
179
+ const limit = travel(state, bounds, frame);
180
+ const along = toImageAxes(state.x, state.y, state.rotation);
181
+ return fromImageAxes(clamp(along.u, -limit.u, limit.u), clamp(along.v, -limit.v, limit.v), state.rotation);
182
+ }
183
+
184
+ /** The state a gesture settles into: in range, and inside the bounds. */
185
+ export function settle(state, bounds, frame) {
186
+ 'worklet';
187
+
188
+ const lowest = minScale(bounds, frame, state.rotation);
189
+ const scale = clamp(state.scale, lowest, Math.max(lowest, bounds.maxZoom));
190
+ const next = {
191
+ ...state,
192
+ scale
193
+ };
194
+ return {
195
+ ...next,
196
+ ...clampTranslation(next, bounds, frame)
197
+ };
198
+ }
199
+
200
+ /**
201
+ * True when every point of the mask is on the photo — when a crop needs no
202
+ * background at all. Always true with `cover` on, once settled.
203
+ */
204
+ export function coversMask(state, shape, frame) {
205
+ 'worklet';
206
+
207
+ const reach = maskReach(shape, frame.mask, state.rotation);
208
+ const along = toImageAxes(state.x, state.y, state.rotation);
209
+ const slack = 0.5;
210
+ return Math.abs(along.u) <= state.scale * frame.image.width / 2 - reach + slack && Math.abs(along.v) <= state.scale * frame.image.height / 2 - reach + slack;
211
+ }
212
+
213
+ /** An overshoot past a bound, compressed so it gives but never runs away. */
214
+ export function rubberBand(overshoot, dimension) {
215
+ 'worklet';
216
+
217
+ if (dimension <= 0) return 0;
218
+ const sign = overshoot < 0 ? -1 : 1;
219
+ const distance = Math.abs(overshoot);
220
+ return sign * (1 - 1 / (distance * RUBBER_BAND / dimension + 1)) * dimension;
221
+ }
222
+
223
+ /**
224
+ * What to draw while a gesture is still going: the raw state, with anything
225
+ * past a bound rubber-banded back towards it. At rest the raw state is already
226
+ * settled and this returns it unchanged.
227
+ */
228
+ export function present(state, bounds, frame) {
229
+ 'worklet';
230
+
231
+ const lowest = minScale(bounds, frame, state.rotation);
232
+ const highest = Math.max(lowest, bounds.maxZoom);
233
+ let scale = state.scale;
234
+ if (scale < lowest) scale = lowest - rubberBand(lowest - scale, lowest / 2);else if (scale > highest) scale = highest + rubberBand(scale - highest, highest / 2);
235
+ const next = {
236
+ ...state,
237
+ scale
238
+ };
239
+ const limit = travel(next, bounds, frame);
240
+ const along = toImageAxes(state.x, state.y, state.rotation);
241
+ const u = clamp(along.u, -limit.u, limit.u);
242
+ const v = clamp(along.v, -limit.v, limit.v);
243
+ const offset = fromImageAxes(u + rubberBand(along.u - u, frame.mask), v + rubberBand(along.v - v, frame.mask), state.rotation);
244
+ return {
245
+ ...next,
246
+ ...offset
247
+ };
248
+ }
249
+
250
+ /** Scale by `factor` about a point, given relative to the canvas centre. */
251
+ export function zoomAbout(state, factor, fx, fy) {
252
+ 'worklet';
253
+
254
+ return {
255
+ ...state,
256
+ scale: state.scale * factor,
257
+ x: fx + (state.x - fx) * factor,
258
+ y: fy + (state.y - fy) * factor
259
+ };
260
+ }
261
+
262
+ /** Turn by `degrees` about a point, given relative to the canvas centre. */
263
+ export function rotateAbout(state, degrees, ax, ay) {
264
+ 'worklet';
265
+
266
+ const {
267
+ cos,
268
+ sin
269
+ } = trig(degrees);
270
+ const dx = state.x - ax;
271
+ const dy = state.y - ay;
272
+ return {
273
+ ...state,
274
+ rotation: state.rotation + degrees,
275
+ x: ax + cos * dx - sin * dy,
276
+ y: ay + sin * dx + cos * dy
277
+ };
278
+ }
279
+
280
+ /** The next quarter turn from wherever the photo is, in either direction. */
281
+ export function nextQuarterTurn(rotation, direction) {
282
+ 'worklet';
283
+
284
+ const quarters = rotation / 90;
285
+ const nearest = Math.round(quarters);
286
+ // Already on a quarter turn: step a whole one. Part way: finish this one.
287
+ const onQuarter = Math.abs(quarters - nearest) < 1e-6;
288
+ const base = onQuarter ? nearest : direction > 0 ? Math.floor(quarters) : Math.ceil(quarters);
289
+ return (base + direction) * 90;
290
+ }
291
+
292
+ /**
293
+ * The square the mask covers, in the source's pixels.
294
+ *
295
+ * The export turns the source first and cuts an upright square from the
296
+ * result, because a turned square cannot be cut directly. Turning grows the
297
+ * canvas to the turned image's bounding box with the image still centred, and
298
+ * a point at `p` from the source's centre lands at `R(θ)·p` from the canvas
299
+ * centre. The mask's centre sits at `R(−θ)·(−x, −y) / scale` in the photo, so
300
+ * after the turn it lands at `−(x, y) / scale` — the rotation cancels, and the
301
+ * crop is the mask's offset scaled into pixels.
302
+ */
303
+ export function sourceCrop(state, frame, source, /** Keep the rectangle on the turned image. Off, it can reach past the edges. */
304
+ onImage = true) {
305
+ 'worklet';
306
+
307
+ const rotation = normalizeDegrees(state.rotation);
308
+ const {
309
+ cos,
310
+ sin
311
+ } = trig(rotation);
312
+ // Both platforms round the turned canvas down to whole pixels.
313
+ const canvas = {
314
+ width: Math.floor(Math.abs(source.width * cos) + Math.abs(source.height * sin) + 1e-6),
315
+ height: Math.floor(Math.abs(source.width * sin) + Math.abs(source.height * cos) + 1e-6)
316
+ };
317
+ // Screen points per source pixel, at the current scale.
318
+ const pointsPerPixel = frame.image.width / source.width * state.scale;
319
+ const full = Math.max(1, Math.floor(frame.mask / pointsPerPixel));
320
+ const side = onImage ? Math.max(1, Math.min(full, canvas.width, canvas.height)) : full;
321
+ const centreX = canvas.width / 2 - state.x / pointsPerPixel;
322
+ const centreY = canvas.height / 2 - state.y / pointsPerPixel;
323
+ const originX = Math.round(centreX - side / 2);
324
+ const originY = Math.round(centreY - side / 2);
325
+ return {
326
+ originX: onImage ? clamp(originX, 0, canvas.width - side) : originX,
327
+ originY: onImage ? clamp(originY, 0, canvas.height - side) : originY,
328
+ width: side,
329
+ height: side,
330
+ rotation,
331
+ canvas
332
+ };
333
+ }
334
+
335
+ /** Superellipse exponent for the squircle. Four is soft; five reads as an app icon. */
336
+ const SQUIRCLE_EXPONENT = 5;
337
+ const SQUIRCLE_STEPS = 128;
338
+
339
+ /** The mask's outline as an SVG path, centred on (`cx`, `cy`). */
340
+ export function maskPath(shape, cx, cy, mask) {
341
+ const r = mask / 2;
342
+ if (shape === 'square') {
343
+ return `M${cx - r} ${cy - r}H${cx + r}V${cy + r}H${cx - r}Z`;
344
+ }
345
+ if (shape === 'circle') {
346
+ return `M${cx - r} ${cy}A${r} ${r} 0 1 0 ${cx + r} ${cy}A${r} ${r} 0 1 0 ${cx - r} ${cy}Z`;
347
+ }
348
+ const exponent = 2 / SQUIRCLE_EXPONENT;
349
+ let path = '';
350
+ for (let step = 0; step < SQUIRCLE_STEPS; step += 1) {
351
+ const t = step / SQUIRCLE_STEPS * Math.PI * 2;
352
+ const cos = Math.cos(t);
353
+ const sin = Math.sin(t);
354
+ const x = cx + r * Math.sign(cos) * Math.abs(cos) ** exponent;
355
+ const y = cy + r * Math.sign(sin) * Math.abs(sin) ** exponent;
356
+ path += `${step === 0 ? 'M' : 'L'}${x.toFixed(2)} ${y.toFixed(2)}`;
357
+ }
358
+ return `${path}Z`;
359
+ }
360
+ //# sourceMappingURL=avatar-cropper-math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IDENTITY","x","y","scale","rotation","RUBBER_BAND","EPSILON","clamp","value","min","max","Math","trig","degrees","radians","PI","cos","sin","abs","normalizeDegrees","folded","baseSize","source","mask","shortSide","width","height","factor","maskReach","shape","half","minScale","bounds","frame","covering","cover","longSide","image","minZoom","toImageAxes","u","v","fromImageAxes","travel","state","reach","clampTranslation","limit","along","settle","lowest","maxZoom","next","coversMask","slack","rubberBand","overshoot","dimension","sign","distance","present","highest","offset","zoomAbout","fx","fy","rotateAbout","ax","ay","dx","dy","nextQuarterTurn","direction","quarters","nearest","round","onQuarter","base","floor","ceil","sourceCrop","onImage","canvas","pointsPerPixel","full","side","centreX","centreY","originX","originY","SQUIRCLE_EXPONENT","SQUIRCLE_STEPS","maskPath","cx","cy","r","exponent","path","step","t","toFixed"],"sourceRoot":"../../../../src","sources":["components/avatar-cropper/avatar-cropper-math.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;;AAQA;;AAMA;;AAaA,OAAO,MAAMA,QAAmB,GAAG;EAAEC,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE,CAAC;EAAEC,KAAK,EAAE,CAAC;EAAEC,QAAQ,EAAE;AAAE,CAAC;;AAExE;AACA,MAAMC,WAAW,GAAG,IAAI;;AAExB;AACA,MAAMC,OAAO,GAAG,IAAI;AAEpB,OAAO,SAASC,KAAKA,CAACC,KAAa,EAAEC,GAAW,EAAEC,GAAW,EAAU;EACrE,SAAS;;EACT,OAAOC,IAAI,CAACF,GAAG,CAACE,IAAI,CAACD,GAAG,CAACF,KAAK,EAAEC,GAAG,CAAC,EAAEC,GAAG,CAAC;AAC5C;AAEA,SA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