@instruments/quadrat 0.0.0-stage → 0.1.1
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/README.md +40 -2
- package/dist/analysis/analyze-surface-regions.d.ts +34 -0
- package/dist/analysis/analyze-surface-regions.d.ts.map +1 -0
- package/dist/analysis/analyze-surface-regions.js +47 -0
- package/dist/analysis/decode.d.ts +23 -0
- package/dist/analysis/decode.d.ts.map +1 -0
- package/dist/analysis/decode.js +48 -0
- package/dist/analysis/descriptors.d.ts +112 -0
- package/dist/analysis/descriptors.d.ts.map +1 -0
- package/dist/analysis/descriptors.js +248 -0
- package/dist/analysis/diagnostics.d.ts +45 -0
- package/dist/analysis/diagnostics.d.ts.map +1 -0
- package/dist/analysis/diagnostics.js +34 -0
- package/dist/analysis/index.d.ts +6 -0
- package/dist/analysis/index.d.ts.map +1 -0
- package/dist/analysis/index.js +2 -0
- package/dist/analysis/outline.d.ts +44 -0
- package/dist/analysis/outline.d.ts.map +1 -0
- package/dist/analysis/outline.js +301 -0
- package/dist/analysis/rank-suggestions.d.ts +21 -0
- package/dist/analysis/rank-suggestions.d.ts.map +1 -0
- package/dist/analysis/rank-suggestions.js +150 -0
- package/dist/analysis/repetition.d.ts +31 -0
- package/dist/analysis/repetition.d.ts.map +1 -0
- package/dist/analysis/repetition.js +105 -0
- package/dist/analysis/segmentation.d.ts +26 -0
- package/dist/analysis/segmentation.d.ts.map +1 -0
- package/dist/analysis/segmentation.js +81 -0
- package/dist/analysis/square-geometry.d.ts +34 -0
- package/dist/analysis/square-geometry.d.ts.map +1 -0
- package/dist/analysis/square-geometry.js +91 -0
- package/dist/analysis/surface-candidates.d.ts +45 -0
- package/dist/analysis/surface-candidates.d.ts.map +1 -0
- package/dist/analysis/surface-candidates.js +471 -0
- package/dist/analysis/thresholds.d.ts +189 -0
- package/dist/analysis/thresholds.d.ts.map +1 -0
- package/dist/analysis/thresholds.js +189 -0
- package/dist/analysis/types.d.ts +42 -0
- package/dist/analysis/types.d.ts.map +1 -0
- package/dist/analysis/types.js +2 -0
- package/dist/crops/crop-editor-state.d.ts +88 -0
- package/dist/crops/crop-editor-state.d.ts.map +1 -0
- package/dist/crops/crop-editor-state.js +121 -0
- package/dist/crops/crop-entries.d.ts +47 -0
- package/dist/crops/crop-entries.d.ts.map +1 -0
- package/dist/crops/crop-entries.js +46 -0
- package/dist/crops/crop-export.d.ts +21 -0
- package/dist/crops/crop-export.d.ts.map +1 -0
- package/dist/crops/crop-export.js +38 -0
- package/dist/crops/crop-geometry.d.ts +130 -0
- package/dist/crops/crop-geometry.d.ts.map +1 -0
- package/dist/crops/crop-geometry.js +271 -0
- package/dist/crops/crop-gesture.d.ts +175 -0
- package/dist/crops/crop-gesture.d.ts.map +1 -0
- package/dist/crops/crop-gesture.js +188 -0
- package/dist/crops/index.d.ts +10 -0
- package/dist/crops/index.d.ts.map +1 -0
- package/dist/crops/index.js +5 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/surface-types.d.ts +41 -0
- package/dist/surface-types.d.ts.map +1 -0
- package/dist/surface-types.js +1 -0
- package/dist/worker/index.d.ts +4 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +1 -0
- package/dist/worker/protocol.d.ts +28 -0
- package/dist/worker/protocol.d.ts.map +1 -0
- package/dist/worker/protocol.js +1 -0
- package/dist/worker/run-analysis.d.ts +21 -0
- package/dist/worker/run-analysis.d.ts.map +1 -0
- package/dist/worker/run-analysis.js +36 -0
- package/dist/worker/surface-worker.d.ts +2 -0
- package/dist/worker/surface-worker.d.ts.map +1 -0
- package/dist/worker/surface-worker.js +36 -0
- package/package.json +123 -3
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { SurfaceSuggestion } from "../analysis/analyze-surface-regions.js";
|
|
2
|
+
import type { PercentRectangle } from "../analysis/types.js";
|
|
3
|
+
/** Width and height only, so geometry never needs a decoded bitmap. */
|
|
4
|
+
export interface ImageSize {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
/** Percent units (0-100) relative to the original image, not CSS viewport pixels. */
|
|
9
|
+
export type PercentCrop = PercentRectangle;
|
|
10
|
+
/** Integer source-image pixels used by Canvas drawImage and JPEG export. */
|
|
11
|
+
export interface PixelCrop {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
|
17
|
+
/** Smallest side, in source pixels, a crop can be resized or drawn to. */
|
|
18
|
+
export declare const MIN_SIDE = 64;
|
|
19
|
+
/**
|
|
20
|
+
* Source pixels per display pixel on each axis. Multiply a distance on screen
|
|
21
|
+
* by this to get the same distance in the source photo.
|
|
22
|
+
*/
|
|
23
|
+
export interface Scale {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}
|
|
27
|
+
/** A rectangle in display pixels, measured from the photo's top-left corner (not the page's). */
|
|
28
|
+
export interface ScreenBox {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
}
|
|
34
|
+
/** Edge coordinates a dragged edge is pulled towards. */
|
|
35
|
+
export interface Targets {
|
|
36
|
+
xs: number[];
|
|
37
|
+
ys: number[];
|
|
38
|
+
}
|
|
39
|
+
/** The snap lines to draw: the source-pixel position of each, or null for none on that axis. */
|
|
40
|
+
export interface Guides {
|
|
41
|
+
x: number | null;
|
|
42
|
+
y: number | null;
|
|
43
|
+
}
|
|
44
|
+
export interface Snap {
|
|
45
|
+
targets: Targets;
|
|
46
|
+
/** Pull distance in source pixels. */
|
|
47
|
+
threshold: number;
|
|
48
|
+
}
|
|
49
|
+
/** A box plus the snap lines that pulled it, if any. */
|
|
50
|
+
export interface Edit {
|
|
51
|
+
box: PixelCrop;
|
|
52
|
+
guides: Guides;
|
|
53
|
+
}
|
|
54
|
+
/** Which corner of a square is being dragged: north or south, west or east. */
|
|
55
|
+
export type Corner = "nw" | "ne" | "sw" | "se";
|
|
56
|
+
/** Guides for "nothing snapped". */
|
|
57
|
+
export declare const NO_GUIDES: Guides;
|
|
58
|
+
/** A square from its top-left corner and side length. */
|
|
59
|
+
export declare const squareBox: (x: number, y: number, side: number) => PixelCrop;
|
|
60
|
+
/** Whether two squares are the same. It compares position and width only, so both must be square. */
|
|
61
|
+
export declare const sameBox: (a: PixelCrop, b: PixelCrop) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The one guarantee every editing function ends with: an integer square that
|
|
64
|
+
* lies inside the image. A side below `MIN_SIDE` is left alone (a small
|
|
65
|
+
* suggestion can be moved); the editing functions enforce their own minimum.
|
|
66
|
+
*/
|
|
67
|
+
export declare const fitBox: (box: PixelCrop, size: ImageSize) => PixelCrop;
|
|
68
|
+
/**
|
|
69
|
+
* Percent to source pixels, as whole numbers inside the image.
|
|
70
|
+
* With `square` (the detector's crops) it rounds inward and returns the largest
|
|
71
|
+
* square that fits, so rounding never takes in a neighboring pixel. Without it,
|
|
72
|
+
* edges round to the nearest pixel and the width and height stay separate; the
|
|
73
|
+
* preview canvas uses that form.
|
|
74
|
+
*/
|
|
75
|
+
export declare const cropPixels: (crop: PercentCrop, size: ImageSize, square?: boolean) => PixelCrop;
|
|
76
|
+
/** Source pixels to percentages of the image, the unit the preview canvas reads. */
|
|
77
|
+
export declare const toPercent: (box: PixelCrop, size: ImageSize) => PercentCrop;
|
|
78
|
+
/** Whether the suggestion's largest square (`maxCrop`) is bigger than its own, once both are rounded to source pixels. Decides if Expand is offered. */
|
|
79
|
+
export declare const canExpand: (suggestion: SurfaceSuggestion, size: ImageSize) => boolean;
|
|
80
|
+
/** Largest size at which the image fits the slot without cropping or distortion. Whole display pixels, at least 1. */
|
|
81
|
+
export declare const containSize: (source: ImageSize, slot: ImageSize) => ImageSize;
|
|
82
|
+
/**
|
|
83
|
+
* Source pixels per display pixel, per axis. `containSize` floors the two sides
|
|
84
|
+
* separately, so the scales differ slightly and must not be shared.
|
|
85
|
+
*/
|
|
86
|
+
export declare const displayScale: (source: ImageSize, display: ImageSize) => Scale;
|
|
87
|
+
/** A source-pixel box in display pixels. */
|
|
88
|
+
export declare const scaleBox: (box: PixelCrop, scale: Scale) => ScreenBox;
|
|
89
|
+
/** The smallest box holding the point, the earlier on a tie; -1 when none does. */
|
|
90
|
+
export declare const cropIndexAt: (boxes: PixelCrop[], x: number, y: number) => number;
|
|
91
|
+
/**
|
|
92
|
+
* The edges a drag can snap to: the image's own edges plus every non-null box
|
|
93
|
+
* passed in (the callers pass a suggestion's own and largest squares). Each box
|
|
94
|
+
* adds its left and right to `xs` and its top and bottom to `ys`, all in source pixels.
|
|
95
|
+
*/
|
|
96
|
+
export declare const snapTargets: (size: ImageSize, boxes: (PixelCrop | null)[]) => Targets;
|
|
97
|
+
/**
|
|
98
|
+
* Move a square by a source-pixel offset. It is clamped inside the image first,
|
|
99
|
+
* then pulled onto a snap line if one is in range, so the side never changes.
|
|
100
|
+
* `dx` and `dy` are measured from `start`, not from the previous move.
|
|
101
|
+
*/
|
|
102
|
+
export declare const moveBox: (start: PixelCrop, dx: number, dy: number, size: ImageSize, snap?: Snap) => Edit;
|
|
103
|
+
/**
|
|
104
|
+
* Resize from a corner with the opposite corner fixed and the ratio locked, so
|
|
105
|
+
* the result is always a square. `dx` and `dy` are how far the pointer has moved
|
|
106
|
+
* since the press, in source pixels; the larger of the two sets the side.
|
|
107
|
+
* The side stays between `MIN_SIDE` and the room left before the image edge
|
|
108
|
+
* (the room wins if it is smaller than `MIN_SIDE`).
|
|
109
|
+
*/
|
|
110
|
+
export declare const resizeBox: (start: PixelCrop, corner: Corner, dx: number, dy: number, size: ImageSize, snap?: Snap) => Edit;
|
|
111
|
+
/**
|
|
112
|
+
* The square drawn from a press point `(ax, ay)` towards the pointer, which has
|
|
113
|
+
* traveled `(dx, dy)` since; all in source pixels. The press point is one
|
|
114
|
+
* corner, the larger travel sets the side (at least `MIN_SIDE`, unless the image
|
|
115
|
+
* is smaller), and the square is pushed back inside the image.
|
|
116
|
+
*/
|
|
117
|
+
export declare const drawBox: (ax: number, ay: number, dx: number, dy: number, size: ImageSize) => PixelCrop;
|
|
118
|
+
/**
|
|
119
|
+
* Keyboard resize about the center by `step` source pixels on each side (negative
|
|
120
|
+
* shrinks). The side stays between `MIN_SIDE` and the short side of the image.
|
|
121
|
+
*/
|
|
122
|
+
export declare const growBox: (start: PixelCrop, step: number, size: ImageSize) => PixelCrop;
|
|
123
|
+
/**
|
|
124
|
+
* The box a key press produces, or null for a key that does nothing.
|
|
125
|
+
* Arrows move by 1% of the short side (10% with Shift); + and - grow and shrink
|
|
126
|
+
* by the same step (`=` and `_` work too: the unshifted + key and the shifted -
|
|
127
|
+
* key on a US keyboard). A step is at least 1 source pixel.
|
|
128
|
+
*/
|
|
129
|
+
export declare const keyboardBox: (key: string, shift: boolean, box: PixelCrop, size: ImageSize) => PixelCrop | null;
|
|
130
|
+
//# sourceMappingURL=crop-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop-geometry.d.ts","sourceRoot":"","sources":["../../src/crops/crop-geometry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAa7D,uEAAuE;AACvE,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qFAAqF;AACrF,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAE3C,4EAA4E;AAC5E,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,0EAA0E;AAC1E,eAAO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n to. */
|
|
2
|
+
export const MIN_SIDE = 64;
|
|
3
|
+
/** Guides for "nothing snapped". */
|
|
4
|
+
export const NO_GUIDES = { x: null, y: null };
|
|
5
|
+
/** A square from its top-left corner and side length. */
|
|
6
|
+
export const squareBox = (x, y, side) => ({
|
|
7
|
+
height: side,
|
|
8
|
+
width: side,
|
|
9
|
+
x,
|
|
10
|
+
y,
|
|
11
|
+
});
|
|
12
|
+
/** Whether two squares are the same. It compares position and width only, so both must be square. */
|
|
13
|
+
export const sameBox = (a, b) => a.x === b.x && a.y === b.y && a.width === b.width;
|
|
14
|
+
/** Keeps `value` between `low` and `high`; if the range is upside down, `low` wins. */
|
|
15
|
+
const clamp = (value, low, high) => Math.min(Math.max(value, low), Math.max(low, high));
|
|
16
|
+
/**
|
|
17
|
+
* The one guarantee every editing function ends with: an integer square that
|
|
18
|
+
* lies inside the image. A side below `MIN_SIDE` is left alone (a small
|
|
19
|
+
* suggestion can be moved); the editing functions enforce their own minimum.
|
|
20
|
+
*/
|
|
21
|
+
export const fitBox = (box, size) => {
|
|
22
|
+
const side = clamp(Math.round(box.width), 1, Math.min(size.width, size.height));
|
|
23
|
+
return squareBox(clamp(Math.round(box.x), 0, size.width - side), clamp(Math.round(box.y), 0, size.height - side), side);
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Percent to source pixels, as whole numbers inside the image.
|
|
27
|
+
* With `square` (the detector's crops) it rounds inward and returns the largest
|
|
28
|
+
* square that fits, so rounding never takes in a neighboring pixel. Without it,
|
|
29
|
+
* edges round to the nearest pixel and the width and height stay separate; the
|
|
30
|
+
* preview canvas uses that form.
|
|
31
|
+
*/
|
|
32
|
+
export const cropPixels = (crop, size, square = false) => {
|
|
33
|
+
if (square) {
|
|
34
|
+
const left = Math.max(0, Math.ceil((crop.x / 100) * size.width));
|
|
35
|
+
const top = Math.max(0, Math.ceil((crop.y / 100) * size.height));
|
|
36
|
+
const right = Math.min(size.width, Math.floor(((crop.x + crop.width) / 100) * size.width));
|
|
37
|
+
const bottom = Math.min(size.height, Math.floor(((crop.y + crop.height) / 100) * size.height));
|
|
38
|
+
return squareBox(left, top, Math.max(1, Math.min(right - left, bottom - top)));
|
|
39
|
+
}
|
|
40
|
+
const x = Math.max(0, Math.round((crop.x / 100) * size.width));
|
|
41
|
+
const y = Math.max(0, Math.round((crop.y / 100) * size.height));
|
|
42
|
+
return {
|
|
43
|
+
height: Math.max(1, Math.min(size.height - y, Math.round((crop.height / 100) * size.height))),
|
|
44
|
+
width: Math.max(1, Math.min(size.width - x, Math.round((crop.width / 100) * size.width))),
|
|
45
|
+
x,
|
|
46
|
+
y,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/** Source pixels to percentages of the image, the unit the preview canvas reads. */
|
|
50
|
+
export const toPercent = (box, size) => ({
|
|
51
|
+
height: (box.height * 100) / size.height,
|
|
52
|
+
width: (box.width * 100) / size.width,
|
|
53
|
+
x: (box.x * 100) / size.width,
|
|
54
|
+
y: (box.y * 100) / size.height,
|
|
55
|
+
});
|
|
56
|
+
/** Whether the suggestion's largest square (`maxCrop`) is bigger than its own, once both are rounded to source pixels. Decides if Expand is offered. */
|
|
57
|
+
export const canExpand = (suggestion, size) => {
|
|
58
|
+
const small = cropPixels(suggestion.crop, size, true);
|
|
59
|
+
const large = cropPixels(suggestion.maxCrop, size, true);
|
|
60
|
+
return large.width * large.height > small.width * small.height;
|
|
61
|
+
};
|
|
62
|
+
/** Largest size at which the image fits the slot without cropping or distortion. Whole display pixels, at least 1. */
|
|
63
|
+
export const containSize = (source, slot) => {
|
|
64
|
+
const scale = Math.min(slot.width / source.width, slot.height / source.height);
|
|
65
|
+
return {
|
|
66
|
+
height: Math.max(1, Math.floor(source.height * scale)),
|
|
67
|
+
width: Math.max(1, Math.floor(source.width * scale)),
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Source pixels per display pixel, per axis. `containSize` floors the two sides
|
|
72
|
+
* separately, so the scales differ slightly and must not be shared.
|
|
73
|
+
*/
|
|
74
|
+
export const displayScale = (source, display) => ({
|
|
75
|
+
x: source.width / display.width,
|
|
76
|
+
y: source.height / display.height,
|
|
77
|
+
});
|
|
78
|
+
/** A source-pixel box in display pixels. */
|
|
79
|
+
export const scaleBox = (box, scale) => ({
|
|
80
|
+
height: box.height / scale.y,
|
|
81
|
+
width: box.width / scale.x,
|
|
82
|
+
x: box.x / scale.x,
|
|
83
|
+
y: box.y / scale.y,
|
|
84
|
+
});
|
|
85
|
+
/** Whether the point is inside the box, edges included. */
|
|
86
|
+
const containsPoint = (box, x, y) => x >= box.x && x <= box.x + box.width && y >= box.y && y <= box.y + box.height;
|
|
87
|
+
/** The smallest box holding the point, the earlier on a tie; -1 when none does. */
|
|
88
|
+
export const cropIndexAt = (boxes, x, y) => {
|
|
89
|
+
let best = -1;
|
|
90
|
+
let bestArea = Infinity;
|
|
91
|
+
for (const [index, box] of boxes.entries()) {
|
|
92
|
+
const area = box.width * box.height;
|
|
93
|
+
if (containsPoint(box, x, y) && area < bestArea) {
|
|
94
|
+
best = index;
|
|
95
|
+
bestArea = area;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return best;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* The edges a drag can snap to: the image's own edges plus every non-null box
|
|
102
|
+
* passed in (the callers pass a suggestion's own and largest squares). Each box
|
|
103
|
+
* adds its left and right to `xs` and its top and bottom to `ys`, all in source pixels.
|
|
104
|
+
*/
|
|
105
|
+
export const snapTargets = (size, boxes) => {
|
|
106
|
+
const xs = [0, size.width];
|
|
107
|
+
const ys = [0, size.height];
|
|
108
|
+
for (const box of boxes) {
|
|
109
|
+
if (box !== null) {
|
|
110
|
+
xs.push(box.x, box.x + box.width);
|
|
111
|
+
ys.push(box.y, box.y + box.width);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return { xs, ys };
|
|
115
|
+
};
|
|
116
|
+
/** Nearest target to either end of a span (its start or its far edge), within the threshold. */
|
|
117
|
+
const pullSpan = (start, length, targets, threshold) => {
|
|
118
|
+
let best = null;
|
|
119
|
+
for (const target of targets) {
|
|
120
|
+
for (const delta of [target - start, target - (start + length)]) {
|
|
121
|
+
if (Math.abs(delta) <= threshold &&
|
|
122
|
+
(best === null || Math.abs(delta) < Math.abs(best.delta))) {
|
|
123
|
+
best = { delta, target };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return best;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Move a square by a source-pixel offset. It is clamped inside the image first,
|
|
131
|
+
* then pulled onto a snap line if one is in range, so the side never changes.
|
|
132
|
+
* `dx` and `dy` are measured from `start`, not from the previous move.
|
|
133
|
+
*/
|
|
134
|
+
export const moveBox = (start, dx, dy, size, snap) => {
|
|
135
|
+
const side = start.width;
|
|
136
|
+
let x = clamp(start.x + dx, 0, size.width - side);
|
|
137
|
+
let y = clamp(start.y + dy, 0, size.height - side);
|
|
138
|
+
let guides = NO_GUIDES;
|
|
139
|
+
if (snap) {
|
|
140
|
+
const pullX = pullSpan(x, side, snap.targets.xs, snap.threshold);
|
|
141
|
+
const pullY = pullSpan(y, side, snap.targets.ys, snap.threshold);
|
|
142
|
+
x += pullX?.delta ?? 0;
|
|
143
|
+
y += pullY?.delta ?? 0;
|
|
144
|
+
guides = { x: pullX?.target ?? null, y: pullY?.target ?? null };
|
|
145
|
+
}
|
|
146
|
+
return { box: fitBox(squareBox(x, y, side), size), guides };
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* The snap that lands the moving corner closest to a target, if any is in range.
|
|
150
|
+
* A target on x or y fixes the side as its distance from the fixed corner (`sign`
|
|
151
|
+
* points away from it); it only counts if that side is within `limits`.
|
|
152
|
+
* `next` is the side the pointer asked for.
|
|
153
|
+
*/
|
|
154
|
+
const bestSnap = (snap, fixed, sign, next, limits) => {
|
|
155
|
+
const edge = { x: fixed.x + sign.x * next, y: fixed.y + sign.y * next };
|
|
156
|
+
let best = null;
|
|
157
|
+
const consider = (candidate, delta) => {
|
|
158
|
+
const inRange = delta <= snap.threshold &&
|
|
159
|
+
candidate.side >= limits.min &&
|
|
160
|
+
candidate.side <= limits.max;
|
|
161
|
+
if (inRange && (best === null || delta < best.delta)) {
|
|
162
|
+
best = { ...candidate, delta };
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
for (const target of snap.targets.xs) {
|
|
166
|
+
consider({
|
|
167
|
+
delta: 0,
|
|
168
|
+
guides: { x: target, y: null },
|
|
169
|
+
side: sign.x * (target - fixed.x),
|
|
170
|
+
}, Math.abs(target - edge.x));
|
|
171
|
+
}
|
|
172
|
+
for (const target of snap.targets.ys) {
|
|
173
|
+
consider({
|
|
174
|
+
delta: 0,
|
|
175
|
+
guides: { x: null, y: target },
|
|
176
|
+
side: sign.y * (target - fixed.y),
|
|
177
|
+
}, Math.abs(target - edge.y));
|
|
178
|
+
}
|
|
179
|
+
return best;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Resize from a corner with the opposite corner fixed and the ratio locked, so
|
|
183
|
+
* the result is always a square. `dx` and `dy` are how far the pointer has moved
|
|
184
|
+
* since the press, in source pixels; the larger of the two sets the side.
|
|
185
|
+
* The side stays between `MIN_SIDE` and the room left before the image edge
|
|
186
|
+
* (the room wins if it is smaller than `MIN_SIDE`).
|
|
187
|
+
*/
|
|
188
|
+
export const resizeBox = (start, corner, dx, dy, size, snap) => {
|
|
189
|
+
const side = start.width;
|
|
190
|
+
const west = corner === "nw" || corner === "sw";
|
|
191
|
+
const north = corner === "nw" || corner === "ne";
|
|
192
|
+
// `sign` points from the fixed corner towards the dragged one on each axis.
|
|
193
|
+
const sign = { x: west ? -1 : 1, y: north ? -1 : 1 };
|
|
194
|
+
const fixed = {
|
|
195
|
+
x: west ? start.x + side : start.x,
|
|
196
|
+
y: north ? start.y + side : start.y,
|
|
197
|
+
};
|
|
198
|
+
// Where the dragged corner is now (`px`, `py`), had it followed the pointer freely.
|
|
199
|
+
const px = (west ? start.x : start.x + side) + dx;
|
|
200
|
+
const py = (north ? start.y : start.y + side) + dy;
|
|
201
|
+
// Most side the square can have before the dragged corner leaves the image.
|
|
202
|
+
const max = Math.min(sign.x > 0 ? size.width - fixed.x : fixed.x, sign.y > 0 ? size.height - fixed.y : fixed.y);
|
|
203
|
+
// The room left can be below the usual minimum (a small crop near an edge),
|
|
204
|
+
// and the room wins: a crop never leaves the image to honor the minimum.
|
|
205
|
+
const min = Math.min(MIN_SIDE, size.width, size.height, max);
|
|
206
|
+
// The ratio is locked, so the axis the pointer has pulled further decides the side.
|
|
207
|
+
let next = clamp(Math.max(sign.x * (px - fixed.x), sign.y * (py - fixed.y)), min, max);
|
|
208
|
+
let guides = NO_GUIDES;
|
|
209
|
+
if (snap) {
|
|
210
|
+
const best = bestSnap(snap, fixed, sign, next, { max, min });
|
|
211
|
+
if (best) {
|
|
212
|
+
({ guides, side: next } = best);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Only now round to whole pixels, so snapping and clamping worked on exact values.
|
|
216
|
+
const rounded = Math.round(next);
|
|
217
|
+
return {
|
|
218
|
+
box: fitBox(squareBox(sign.x > 0 ? fixed.x : fixed.x - rounded, sign.y > 0 ? fixed.y : fixed.y - rounded, rounded), size),
|
|
219
|
+
guides,
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* The square drawn from a press point `(ax, ay)` towards the pointer, which has
|
|
224
|
+
* traveled `(dx, dy)` since; all in source pixels. The press point is one
|
|
225
|
+
* corner, the larger travel sets the side (at least `MIN_SIDE`, unless the image
|
|
226
|
+
* is smaller), and the square is pushed back inside the image.
|
|
227
|
+
*/
|
|
228
|
+
export const drawBox = (ax, ay, dx, dy, size) => {
|
|
229
|
+
const min = Math.min(MIN_SIDE, size.width, size.height);
|
|
230
|
+
const side = Math.round(clamp(Math.max(Math.abs(dx), Math.abs(dy)), min, Math.min(size.width, size.height)));
|
|
231
|
+
return fitBox(squareBox(dx >= 0 ? ax : ax - side, dy >= 0 ? ay : ay - side, side), size);
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Keyboard resize about the center by `step` source pixels on each side (negative
|
|
235
|
+
* shrinks). The side stays between `MIN_SIDE` and the short side of the image.
|
|
236
|
+
*/
|
|
237
|
+
export const growBox = (start, step, size) => {
|
|
238
|
+
const min = Math.min(MIN_SIDE, size.width, size.height);
|
|
239
|
+
const side = Math.round(clamp(start.width + step * 2, min, Math.min(size.width, size.height)));
|
|
240
|
+
const centerX = start.x + start.width / 2;
|
|
241
|
+
const centerY = start.y + start.width / 2;
|
|
242
|
+
return fitBox(squareBox(centerX - side / 2, centerY - side / 2, side), size);
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* The box a key press produces, or null for a key that does nothing.
|
|
246
|
+
* Arrows move by 1% of the short side (10% with Shift); + and - grow and shrink
|
|
247
|
+
* by the same step (`=` and `_` work too: the unshifted + key and the shifted -
|
|
248
|
+
* key on a US keyboard). A step is at least 1 source pixel.
|
|
249
|
+
*/
|
|
250
|
+
export const keyboardBox = (key, shift, box, size) => {
|
|
251
|
+
const unit = Math.min(size.width, size.height) * (shift ? 0.1 : 0.01);
|
|
252
|
+
const step = Math.max(1, Math.round(unit));
|
|
253
|
+
const moves = new Map([
|
|
254
|
+
["ArrowDown", [0, step]],
|
|
255
|
+
["ArrowLeft", [-step, 0]],
|
|
256
|
+
["ArrowRight", [step, 0]],
|
|
257
|
+
["ArrowUp", [0, -step]],
|
|
258
|
+
]);
|
|
259
|
+
const grows = new Map([
|
|
260
|
+
["+", step],
|
|
261
|
+
["-", -step],
|
|
262
|
+
["=", step],
|
|
263
|
+
["_", -step],
|
|
264
|
+
]);
|
|
265
|
+
const move = moves.get(key);
|
|
266
|
+
if (move) {
|
|
267
|
+
return moveBox(box, move[0], move[1], size).box;
|
|
268
|
+
}
|
|
269
|
+
const grow = grows.get(key);
|
|
270
|
+
return grow === undefined ? null : growBox(box, grow, size);
|
|
271
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import type { CropEntry } from "./crop-entries.js";
|
|
2
|
+
import type { Corner, Guides, ImageSize, PixelCrop, Scale } from "./crop-geometry.js";
|
|
3
|
+
/** How close a dragged edge must get to a snap line before it is pulled onto it, in CSS pixels. */
|
|
4
|
+
export declare const SNAP = 8;
|
|
5
|
+
/** Pointer travel before a press on the selected crop, a handle or empty photo becomes a drag, in CSS pixels. Stops a shaky click from nudging a crop. */
|
|
6
|
+
export declare const SLOP = 3;
|
|
7
|
+
/** How long a touch must be held still before it starts drawing, in milliseconds. */
|
|
8
|
+
export declare const HOLD = 350;
|
|
9
|
+
/** Travel that means a touch is a scroll or swipe, not a hold or a tap, in CSS pixels. */
|
|
10
|
+
export declare const HOLD_SLOP = 8;
|
|
11
|
+
/** Like `SLOP`, but for a mouse press on an unselected crop, which selects it and may carry on into a drag. */
|
|
12
|
+
export declare const PICK_SLOP = 4;
|
|
13
|
+
/** The parts of a pointer-down event the gesture rules read. A DOM `PointerEvent` fits, which keeps these rules testable without a browser. */
|
|
14
|
+
export interface Press {
|
|
15
|
+
pointerId: number;
|
|
16
|
+
clientX: number;
|
|
17
|
+
clientY: number;
|
|
18
|
+
pointerType: string;
|
|
19
|
+
button: number;
|
|
20
|
+
}
|
|
21
|
+
/** The parts of a pointer-move event the gesture rules read. */
|
|
22
|
+
export type Pointer = Pick<Press, "clientX" | "clientY" | "pointerId">;
|
|
23
|
+
/**
|
|
24
|
+
* What a press is about to do, decided by the caller from where it landed.
|
|
25
|
+
* `start` is the crop's square at the moment of the press; `ax`, `ay` is the
|
|
26
|
+
* press point in source pixels.
|
|
27
|
+
*/
|
|
28
|
+
export type GestureStart = {
|
|
29
|
+
kind: "move";
|
|
30
|
+
id: string;
|
|
31
|
+
start: PixelCrop;
|
|
32
|
+
slop?: number;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "resize";
|
|
35
|
+
id: string;
|
|
36
|
+
start: PixelCrop;
|
|
37
|
+
corner: Corner;
|
|
38
|
+
}
|
|
39
|
+
/** A touch on an unselected crop: selects on lift, unless the page scrolled. */
|
|
40
|
+
| {
|
|
41
|
+
kind: "pick";
|
|
42
|
+
id: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: "draw";
|
|
45
|
+
ax: number;
|
|
46
|
+
ay: number;
|
|
47
|
+
};
|
|
48
|
+
interface Base {
|
|
49
|
+
pointerId: number;
|
|
50
|
+
/** Where the pointer went down, in client (page-viewport) pixels. */
|
|
51
|
+
startX: number;
|
|
52
|
+
startY: number;
|
|
53
|
+
/** Set once travel passes `slop`, and never cleared: later moves are always real drags. */
|
|
54
|
+
moved: boolean;
|
|
55
|
+
/** Travel before a press becomes a drag. */
|
|
56
|
+
slop: number;
|
|
57
|
+
/** Source pixels per screen pixel when the press began. */
|
|
58
|
+
scale: Scale;
|
|
59
|
+
/** The square the gesture would commit, updated as the pointer moves. */
|
|
60
|
+
result: PixelCrop | null;
|
|
61
|
+
}
|
|
62
|
+
/** Drawing a new crop. `ax`, `ay` is the press point in source pixels: the square's fixed corner. */
|
|
63
|
+
export type DrawGesture = Base & {
|
|
64
|
+
kind: "draw";
|
|
65
|
+
ax: number;
|
|
66
|
+
ay: number;
|
|
67
|
+
/** False while a touch is still waiting out its hold. */
|
|
68
|
+
armed: boolean;
|
|
69
|
+
/** The pending hold timer's id while a touch waits, else null. It is created in `pointer-handlers.ts` and cleared by the hook's `settle`, which gets it back from `finishGesture`. */
|
|
70
|
+
timer: number | null;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* One press-to-lift interaction. Only one is ever active (`acceptPress`).
|
|
74
|
+
*
|
|
75
|
+
* Life of a gesture: a press picks the kind (`beginGesture`). Movement under
|
|
76
|
+
* the kind's slop is ignored; past it, a draw becomes a draft square and a move
|
|
77
|
+
* or resize becomes a live edit (`trackGesture`). A touch is different: a draw
|
|
78
|
+
* is "waiting" until `HOLD` has passed (then armed), and a touch on a crop
|
|
79
|
+
* ("pick") only selects on lift. Travel over `HOLD_SLOP` before a draw is armed,
|
|
80
|
+
* or during a pick, means the page is scrolling, so the gesture is dropped.
|
|
81
|
+
* Lifting keeps the result; canceling, losing pointer capture or being
|
|
82
|
+
* abandoned keeps nothing (`finishGesture`).
|
|
83
|
+
*/
|
|
84
|
+
export type Gesture = DrawGesture | (Base & {
|
|
85
|
+
kind: "move";
|
|
86
|
+
id: string;
|
|
87
|
+
start: PixelCrop;
|
|
88
|
+
}) | (Base & {
|
|
89
|
+
kind: "resize";
|
|
90
|
+
id: string;
|
|
91
|
+
start: PixelCrop;
|
|
92
|
+
corner: Corner;
|
|
93
|
+
}) | (Base & {
|
|
94
|
+
kind: "pick";
|
|
95
|
+
id: string;
|
|
96
|
+
});
|
|
97
|
+
/** An x, y position. The unit depends on the use; each use says which. */
|
|
98
|
+
export interface Point {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
}
|
|
102
|
+
/** A second pointer, or a mouse button other than the primary, never starts a gesture. */
|
|
103
|
+
export declare const acceptPress: (active: Gesture | null, press: Press) => boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Starts a gesture from a press. A mouse draws at once; touch and pen wait for a
|
|
106
|
+
* press-and-hold so the page can still scroll. `scale` is source pixels per
|
|
107
|
+
* screen pixel at the moment of the press and is kept for the whole gesture.
|
|
108
|
+
* Starting the hold timer is the caller's job.
|
|
109
|
+
*/
|
|
110
|
+
export declare const beginGesture: (press: Press, start: GestureStart, scale: Scale) => Gesture;
|
|
111
|
+
/** The hold time has passed: from now on a move draws, and the page must not take the gesture for a scroll. */
|
|
112
|
+
export declare const armGesture: (gesture: DrawGesture) => DrawGesture;
|
|
113
|
+
/** Where a touch hold started, in display pixels from the photo's top-left corner (where the cue is drawn). */
|
|
114
|
+
export declare const holdPoint: (gesture: DrawGesture) => Point;
|
|
115
|
+
/**
|
|
116
|
+
* What the latest pointer move did to the gesture. `ignore` means nothing
|
|
117
|
+
* changed (below the slop, another pointer, or a crop that no longer exists).
|
|
118
|
+
*/
|
|
119
|
+
export type Tracked = {
|
|
120
|
+
type: "ignore";
|
|
121
|
+
}
|
|
122
|
+
/** A swipe or a broken hold: the page is scrolling, so let the gesture go. */
|
|
123
|
+
| {
|
|
124
|
+
type: "abandon";
|
|
125
|
+
} | {
|
|
126
|
+
type: "draft";
|
|
127
|
+
gesture: Gesture;
|
|
128
|
+
box: PixelCrop;
|
|
129
|
+
} | {
|
|
130
|
+
type: "edit";
|
|
131
|
+
gesture: Gesture;
|
|
132
|
+
id: string;
|
|
133
|
+
preview: PixelCrop;
|
|
134
|
+
guides: Guides;
|
|
135
|
+
};
|
|
136
|
+
/** What a gesture needs to know about the photo to turn travel into a square: its source size and the current entries (for snap lines). */
|
|
137
|
+
export interface TrackView {
|
|
138
|
+
size: ImageSize;
|
|
139
|
+
entries: CropEntry[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Turn a pointer move into the next square. An edit returns the raw square for
|
|
143
|
+
* the live preview and keeps the snapped one as the gesture's result: the
|
|
144
|
+
* preview follows the pointer exactly, and the commit lands on the guides.
|
|
145
|
+
* Returns a new gesture inside `draft` and `edit`; the caller must store it.
|
|
146
|
+
*/
|
|
147
|
+
export declare const trackGesture: (gesture: Gesture, pointer: Pointer, view: TrackView) => Tracked;
|
|
148
|
+
/** What lifting, canceling or losing the pointer asks the editor to do. At most one of `select`, `clear`, `draw` and `commit` is set. */
|
|
149
|
+
export interface Outcome {
|
|
150
|
+
/** A crop to select (a touch tap on an unselected crop). */
|
|
151
|
+
select: string | null;
|
|
152
|
+
/** A tap on the empty photo, which clears the selection. */
|
|
153
|
+
clear: boolean;
|
|
154
|
+
/** A new crop the user drew. */
|
|
155
|
+
draw: PixelCrop | null;
|
|
156
|
+
/** An adjusted square to keep. */
|
|
157
|
+
commit: {
|
|
158
|
+
id: string;
|
|
159
|
+
box: PixelCrop;
|
|
160
|
+
} | null;
|
|
161
|
+
/** The crop whose live preview must be dropped. */
|
|
162
|
+
clearLive: string | null;
|
|
163
|
+
/** A pending hold timer to clear. */
|
|
164
|
+
timer: number | null;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Ends a gesture. A lift (`canceled` false) keeps the result if the pointer
|
|
168
|
+
* really moved: a drawn square, or an adjusted square that differs from where it
|
|
169
|
+
* started. A cancel (pointer canceled, capture lost, scroll detected,
|
|
170
|
+
* interaction disabled) keeps nothing: it only clears what the gesture had put
|
|
171
|
+
* on screen, and hands back any hold timer so the caller can clear it.
|
|
172
|
+
*/
|
|
173
|
+
export declare const finishGesture: (gesture: Gesture, canceled: boolean) => Outcome;
|
|
174
|
+
export {};
|
|
175
|
+
//# sourceMappingURL=crop-gesture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop-gesture.d.ts","sourceRoot":"","sources":["../../src/crops/crop-gesture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAQnD,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,EACT,KAAK,EACN,MAAM,oBAAoB,CAAC;AAQ5B,mGAAmG;AACnG,eAAO,MAAM,IAAI,IAAI,CAAC;AACtB,0JAA0J;AAC1J,eAAO,MAAM,IAAI,IAAI,CAAC;AACtB,qFAAqF;AACrF,eAAO,MAAM,IAAI,MAAM,CAAC;AACxB,0FAA0F;AAC1F,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,+GAA+G;AAC/G,eAAO,MAAM,SAAS,IAAI,CAAC;AAE3B,+IAA+I;AAC/I,MAAM,WAAW,KAAK;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,gEAAgE;AAChE,MAAM,MAAM,OAAO,GA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