@sealpixel/ui 1.0.0-rc.7 → 1.0.0-rc.9
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/components/sealpixel-editor.d.ts +4 -0
- package/dist/components/sealpixel-editor.d.ts.map +1 -1
- package/dist/components/sealpixel-editor.js +24 -1
- package/dist/components/sealpixel-editor.js.map +1 -1
- package/dist/components/sealpixel-stage.d.ts +11 -0
- package/dist/components/sealpixel-stage.d.ts.map +1 -1
- package/dist/components/sealpixel-stage.js +23 -4
- package/dist/components/sealpixel-stage.js.map +1 -1
- package/dist/components/sealpixel-toolbar.d.ts +6 -1
- package/dist/components/sealpixel-toolbar.d.ts.map +1 -1
- package/dist/components/sealpixel-toolbar.js +40 -2
- package/dist/components/sealpixel-toolbar.js.map +1 -1
- package/dist/icons.d.ts +1 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +1 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/locales/de.d.ts.map +1 -1
- package/dist/locales/de.js +15 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts.map +1 -1
- package/dist/locales/en.js +15 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.d.ts.map +1 -1
- package/dist/locales/es.js +15 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.d.ts.map +1 -1
- package/dist/locales/fr.js +15 -0
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/ja.d.ts.map +1 -1
- package/dist/locales/ja.js +15 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/pt.d.ts.map +1 -1
- package/dist/locales/pt.js +15 -0
- package/dist/locales/pt.js.map +1 -1
- package/dist/tool.d.ts +12 -0
- package/dist/tool.d.ts.map +1 -1
- package/dist/tools/assist.d.ts +93 -0
- package/dist/tools/assist.d.ts.map +1 -0
- package/dist/tools/assist.js +314 -0
- package/dist/tools/assist.js.map +1 -0
- package/dist/tools/crop-rotation.d.ts +53 -0
- package/dist/tools/crop-rotation.d.ts.map +1 -0
- package/dist/tools/crop-rotation.js +153 -0
- package/dist/tools/crop-rotation.js.map +1 -0
- package/dist/tools/crop.d.ts.map +1 -1
- package/dist/tools/crop.js +58 -9
- package/dist/tools/crop.js.map +1 -1
- package/dist/tools/handles.d.ts +27 -0
- package/dist/tools/handles.d.ts.map +1 -0
- package/dist/tools/handles.js +45 -0
- package/dist/tools/handles.js.map +1 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { ASSIST_DEFAULT_OPTIONS, filterDetections, padRect, REDACT_DEFAULT_OPTIONS, toRedactAdd, } from '@sealpixel/plugins';
|
|
2
|
+
import { html, nothing, svg } from 'lit';
|
|
3
|
+
import { icons } from '../icons.js';
|
|
4
|
+
import { cropClipPath } from './crop-mask.js';
|
|
5
|
+
import { opId } from './finetune.js';
|
|
6
|
+
import { CHECK_PATH, CROSS_PATH, handleRow } from './handles.js';
|
|
7
|
+
export const initialState = {
|
|
8
|
+
sourceKey: null,
|
|
9
|
+
status: 'idle',
|
|
10
|
+
items: [],
|
|
11
|
+
error: null,
|
|
12
|
+
};
|
|
13
|
+
let nextKey = 1;
|
|
14
|
+
/** Pure: the whole suggestion lifecycle, testable without a browser. */
|
|
15
|
+
export function reduce(state, action) {
|
|
16
|
+
switch (action.type) {
|
|
17
|
+
case 'source':
|
|
18
|
+
return state.sourceKey === action.key
|
|
19
|
+
? state
|
|
20
|
+
: { sourceKey: action.key, status: 'idle', items: [], error: null };
|
|
21
|
+
case 'start':
|
|
22
|
+
return { ...state, status: 'loading', error: null };
|
|
23
|
+
case 'detecting':
|
|
24
|
+
return { ...state, status: 'detecting' };
|
|
25
|
+
case 'results':
|
|
26
|
+
return {
|
|
27
|
+
...state,
|
|
28
|
+
status: 'done',
|
|
29
|
+
items: action.detections.map((d) => ({ ...d, key: nextKey++, decision: 'proposed' })),
|
|
30
|
+
};
|
|
31
|
+
case 'fail':
|
|
32
|
+
return { ...state, status: 'error', error: action.message };
|
|
33
|
+
case 'accept':
|
|
34
|
+
case 'reject': {
|
|
35
|
+
const decision = action.type === 'accept' ? 'accepted' : 'rejected';
|
|
36
|
+
return {
|
|
37
|
+
...state,
|
|
38
|
+
items: state.items.map((s) => (s.key === action.key ? { ...s, decision } : s)),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
case 'acceptAll':
|
|
42
|
+
case 'rejectAll': {
|
|
43
|
+
const decision = action.type === 'acceptAll' ? 'accepted' : 'rejected';
|
|
44
|
+
return {
|
|
45
|
+
...state,
|
|
46
|
+
items: state.items.map((s) => (s.decision === 'proposed' ? { ...s, decision } : s)),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
case 'move':
|
|
50
|
+
return {
|
|
51
|
+
...state,
|
|
52
|
+
items: state.items.map((s) => (s.key === action.key ? { ...s, rect: action.rect } : s)),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export const proposed = (state) => state.items.filter((s) => s.decision === 'proposed');
|
|
57
|
+
/** Thrown into the detection when `timeoutMs` passes; its message is the panel's text. */
|
|
58
|
+
export class AssistTimeout extends Error {
|
|
59
|
+
constructor() {
|
|
60
|
+
super(...arguments);
|
|
61
|
+
this.name = 'ASSIST_TIMEOUT';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export function createAssistController(detector) {
|
|
65
|
+
let state = initialState;
|
|
66
|
+
let controller = null;
|
|
67
|
+
const set = (action, ctx) => {
|
|
68
|
+
state = reduce(state, action);
|
|
69
|
+
ctx.refresh();
|
|
70
|
+
};
|
|
71
|
+
const options = (ctx) => ctx.options('assist') ?? ASSIST_DEFAULT_OPTIONS;
|
|
72
|
+
const abort = () => {
|
|
73
|
+
controller?.abort();
|
|
74
|
+
controller = null;
|
|
75
|
+
};
|
|
76
|
+
const accept = (key, ctx) => {
|
|
77
|
+
const item = state.items.find((s) => s.key === key && s.decision === 'proposed');
|
|
78
|
+
if (!item)
|
|
79
|
+
return;
|
|
80
|
+
const opts = options(ctx);
|
|
81
|
+
const redact = ctx.options('redact') ?? REDACT_DEFAULT_OPTIONS;
|
|
82
|
+
ctx.dispatch(toRedactAdd(padRect(item.rect, opts.padding), redact, opId(), opts));
|
|
83
|
+
set({ type: 'accept', key }, ctx);
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
state: () => state,
|
|
87
|
+
options,
|
|
88
|
+
abort,
|
|
89
|
+
syncSource: (ctx) => {
|
|
90
|
+
const source = ctx.state.source;
|
|
91
|
+
const key = source ? (source.hash ?? source.id) : null;
|
|
92
|
+
if (key && key !== state.sourceKey) {
|
|
93
|
+
abort();
|
|
94
|
+
state = reduce(state, { type: 'source', key });
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
run: async (ctx) => {
|
|
98
|
+
abort();
|
|
99
|
+
const own = new AbortController();
|
|
100
|
+
controller = own;
|
|
101
|
+
const opts = options(ctx);
|
|
102
|
+
const timer = setTimeout(() => own.abort(new AssistTimeout(ctx.t('assist.timeout'))), opts.timeoutMs);
|
|
103
|
+
set({ type: 'start' }, ctx);
|
|
104
|
+
try {
|
|
105
|
+
// The unedited, uncropped proxy: what the redact regions are measured against.
|
|
106
|
+
const image = await ctx.session.renderDetached((log) => ({ ...log, ops: [] }), {
|
|
107
|
+
signal: own.signal,
|
|
108
|
+
});
|
|
109
|
+
own.signal.throwIfAborted();
|
|
110
|
+
set({ type: 'detecting' }, ctx);
|
|
111
|
+
const found = await detector.detect(image, { signal: own.signal, options: opts });
|
|
112
|
+
own.signal.throwIfAborted();
|
|
113
|
+
set({ type: 'results', detections: filterDetections(found, opts) }, ctx);
|
|
114
|
+
if (opts.acceptAbove !== null) {
|
|
115
|
+
const threshold = opts.acceptAbove;
|
|
116
|
+
for (const item of proposed(state))
|
|
117
|
+
if (item.score >= threshold)
|
|
118
|
+
accept(item.key, ctx);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
// A timeout is our own abort and gets reported; any other abort is silent.
|
|
123
|
+
if (own.signal.aborted && !(own.signal.reason instanceof AssistTimeout))
|
|
124
|
+
return;
|
|
125
|
+
const reason = own.signal.reason instanceof AssistTimeout ? own.signal.reason : error;
|
|
126
|
+
set({ type: 'fail', message: reason.message }, ctx);
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
clearTimeout(timer);
|
|
130
|
+
if (controller === own)
|
|
131
|
+
controller = null;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
accept,
|
|
135
|
+
reject: (key, ctx) => set({ type: 'reject', key }, ctx),
|
|
136
|
+
acceptAll: (ctx) => {
|
|
137
|
+
for (const item of proposed(state))
|
|
138
|
+
accept(item.key, ctx);
|
|
139
|
+
},
|
|
140
|
+
rejectAll: (ctx) => set({ type: 'rejectAll' }, ctx),
|
|
141
|
+
move: (key, rect, ctx) => set({ type: 'move', key, rect }, ctx),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** Redact coordinates live in image space: show the image before crop and resize. */
|
|
145
|
+
function beforeCrop(log) {
|
|
146
|
+
return {
|
|
147
|
+
...log,
|
|
148
|
+
ops: [
|
|
149
|
+
...log.ops,
|
|
150
|
+
{ type: 'crop.reset', id: '__sealpixel_preview_crop__' },
|
|
151
|
+
{ type: 'resize.clear', id: '__sealpixel_preview_resize__' },
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function clipToCrop(ctx) {
|
|
156
|
+
const crop = ctx.session.getDocument().crop;
|
|
157
|
+
const preview = ctx.state.preview;
|
|
158
|
+
ctx.clipPreview(preview ? cropClipPath(crop, preview.image.width, preview.image.height) : null);
|
|
159
|
+
}
|
|
160
|
+
export function createAssistTool(detector) {
|
|
161
|
+
const c = createAssistController(detector);
|
|
162
|
+
let drag = null;
|
|
163
|
+
const busy = () => {
|
|
164
|
+
const s = c.state().status;
|
|
165
|
+
return s === 'loading' || s === 'detecting';
|
|
166
|
+
};
|
|
167
|
+
return {
|
|
168
|
+
id: 'assist',
|
|
169
|
+
icon: icons.assist,
|
|
170
|
+
label: 'tool.assist',
|
|
171
|
+
onSource: (ctx) => {
|
|
172
|
+
c.syncSource(ctx);
|
|
173
|
+
if (c.options(ctx).run === 'load' && c.state().status === 'idle')
|
|
174
|
+
void c.run(ctx);
|
|
175
|
+
},
|
|
176
|
+
badge: (ctx) => {
|
|
177
|
+
if (!c.options(ctx).badge || busy())
|
|
178
|
+
return null;
|
|
179
|
+
const n = proposed(c.state()).length;
|
|
180
|
+
return n > 0 ? n : null;
|
|
181
|
+
},
|
|
182
|
+
activate: (ctx) => {
|
|
183
|
+
c.syncSource(ctx);
|
|
184
|
+
clipToCrop(ctx);
|
|
185
|
+
ctx.session.setPreviewTransform(beforeCrop);
|
|
186
|
+
if (c.options(ctx).run === 'select' && c.state().status === 'idle')
|
|
187
|
+
void c.run(ctx);
|
|
188
|
+
},
|
|
189
|
+
deactivate: (ctx) => {
|
|
190
|
+
c.abort();
|
|
191
|
+
drag = null;
|
|
192
|
+
ctx.clipPreview(null);
|
|
193
|
+
ctx.session.setPreviewTransform(null);
|
|
194
|
+
},
|
|
195
|
+
panel: (ctx) => {
|
|
196
|
+
c.syncSource(ctx);
|
|
197
|
+
clipToCrop(ctx);
|
|
198
|
+
if (!ctx.session.registry.byId.has('redact')) {
|
|
199
|
+
return html `<p class="status" role="status">${ctx.t('assist.needsRedact')}</p>`;
|
|
200
|
+
}
|
|
201
|
+
const opts = c.options(ctx);
|
|
202
|
+
const state = c.state();
|
|
203
|
+
const open = proposed(state);
|
|
204
|
+
const text = state.status === 'loading'
|
|
205
|
+
? ctx.t('assist.loading')
|
|
206
|
+
: state.status === 'detecting'
|
|
207
|
+
? ctx.t('assist.detecting')
|
|
208
|
+
: state.status === 'error'
|
|
209
|
+
? ctx.t('assist.error', { message: state.error ?? '' })
|
|
210
|
+
: state.status === 'done'
|
|
211
|
+
? open.length > 0
|
|
212
|
+
? ctx.t('assist.found', { count: open.length })
|
|
213
|
+
: ctx.t('assist.none')
|
|
214
|
+
: '';
|
|
215
|
+
return html `
|
|
216
|
+
<div class="row" role="group" aria-label=${ctx.t('tool.assist')}>
|
|
217
|
+
<div class="group">
|
|
218
|
+
<sealpixel-button data-action="detect" ?disabled=${busy()} @click=${() => void c.run(ctx)}>${ctx.t('assist.detect')}</sealpixel-button>
|
|
219
|
+
${opts.bulk && open.length > 0
|
|
220
|
+
? html `<sealpixel-button data-action="accept-all" variant="primary" @click=${() => c.acceptAll(ctx)}>${ctx.t('assist.acceptAll')}</sealpixel-button>
|
|
221
|
+
<sealpixel-button data-action="reject-all" @click=${() => c.rejectAll(ctx)}>${ctx.t('assist.rejectAll')}</sealpixel-button>`
|
|
222
|
+
: nothing}
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
<p class="status" role="status" data-status=${state.status}>${text}</p>
|
|
226
|
+
`;
|
|
227
|
+
},
|
|
228
|
+
overlay: (ctx) => {
|
|
229
|
+
const { width: W, height: H, zoom } = ctx.stage;
|
|
230
|
+
if (!W || !H)
|
|
231
|
+
return svg ``;
|
|
232
|
+
const opts = c.options(ctx);
|
|
233
|
+
const sw = 1.5 / zoom;
|
|
234
|
+
const toN = (e) => {
|
|
235
|
+
const p = ctx.stage.toImage(e.clientX, e.clientY);
|
|
236
|
+
return [clamp01(p.x / W), clamp01(p.y / H)];
|
|
237
|
+
};
|
|
238
|
+
const shape = (item) => {
|
|
239
|
+
const rect = drag?.key === item.key ? drag.rect : item.rect;
|
|
240
|
+
// Press and move adjusts the proposal before accepting it.
|
|
241
|
+
const down = (e) => {
|
|
242
|
+
e.stopPropagation();
|
|
243
|
+
e.preventDefault();
|
|
244
|
+
if (!opts.adjust)
|
|
245
|
+
return;
|
|
246
|
+
const start = toN(e);
|
|
247
|
+
drag = { key: item.key, rect: item.rect };
|
|
248
|
+
const move = (ev) => {
|
|
249
|
+
if (!drag)
|
|
250
|
+
return;
|
|
251
|
+
const q = toN(ev);
|
|
252
|
+
drag.rect = translate(item.rect, q[0] - start[0], q[1] - start[1]);
|
|
253
|
+
ctx.refresh();
|
|
254
|
+
};
|
|
255
|
+
const up = () => {
|
|
256
|
+
window.removeEventListener('pointermove', move);
|
|
257
|
+
window.removeEventListener('pointerup', up);
|
|
258
|
+
window.removeEventListener('pointercancel', up);
|
|
259
|
+
const d = drag;
|
|
260
|
+
drag = null;
|
|
261
|
+
if (d)
|
|
262
|
+
c.move(item.key, d.rect, ctx);
|
|
263
|
+
else
|
|
264
|
+
ctx.refresh();
|
|
265
|
+
};
|
|
266
|
+
window.addEventListener('pointermove', move);
|
|
267
|
+
window.addEventListener('pointerup', up);
|
|
268
|
+
window.addEventListener('pointercancel', up);
|
|
269
|
+
};
|
|
270
|
+
const px = { x: rect.x * W, y: rect.y * H, width: rect.width * W, height: rect.height * H };
|
|
271
|
+
return svg `
|
|
272
|
+
<rect data-interactive data-suggestion=${item.key} x=${px.x} y=${px.y} width=${px.width} height=${px.height}
|
|
273
|
+
fill="rgba(91,141,239,0.15)" stroke="var(--sealpixel-color-accent)" stroke-width=${sw}
|
|
274
|
+
stroke-dasharray=${`${6 / zoom} ${4 / zoom}`} style=${opts.adjust ? 'cursor:move' : ''} @pointerdown=${down} />
|
|
275
|
+
${opts.showScore
|
|
276
|
+
? svg `<text x=${px.x + 4 / zoom} y=${px.y + px.height - 4 / zoom} font-size=${11 / zoom}
|
|
277
|
+
fill="var(--sealpixel-color-accent)" style="pointer-events:none;font-family:ui-monospace,monospace">${item.score.toFixed(2)}</text>`
|
|
278
|
+
: nothing}
|
|
279
|
+
${handleRow(px, ctx.stage, [
|
|
280
|
+
{
|
|
281
|
+
path: CHECK_PATH,
|
|
282
|
+
label: ctx.t('assist.accept'),
|
|
283
|
+
color: 'var(--sealpixel-color-accent)',
|
|
284
|
+
action: 'accept',
|
|
285
|
+
onActivate: () => c.accept(item.key, ctx),
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
path: CROSS_PATH,
|
|
289
|
+
label: ctx.t('assist.reject'),
|
|
290
|
+
color: 'var(--sealpixel-color-danger)',
|
|
291
|
+
action: 'reject',
|
|
292
|
+
onActivate: () => c.reject(item.key, ctx),
|
|
293
|
+
},
|
|
294
|
+
])}
|
|
295
|
+
`;
|
|
296
|
+
};
|
|
297
|
+
return svg `${proposed(c.state()).map(shape)}`;
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function translate(rect, dx, dy) {
|
|
302
|
+
return {
|
|
303
|
+
...rect,
|
|
304
|
+
x: clamp(rect.x + dx, 0, 1 - rect.width),
|
|
305
|
+
y: clamp(rect.y + dy, 0, 1 - rect.height),
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function clamp01(v) {
|
|
309
|
+
return clamp(v, 0, 1);
|
|
310
|
+
}
|
|
311
|
+
function clamp(v, lo, hi) {
|
|
312
|
+
return v < lo ? lo : v > hi ? hi : v;
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=assist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assist.js","sourceRoot":"","sources":["../../src/tools/assist.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EAItB,gBAAgB,EAChB,OAAO,EACP,sBAAsB,EAEtB,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAiB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,e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C;YACJ,CAAC,CAAC;YACF,OAAO,GAAG,CAAA,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAChD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAU,EAAE,EAAU,EAAE,EAAU;IACnD,OAAO;QACL,GAAG,IAAI;QACP,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACxC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;KAC1C,CAAC;AACJ,CAAC;AACD,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC;AACD,SAAS,KAAK,CAAC,CAAS,EAAE,EAAU,EAAE,EAAU;IAC9C,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the crop rectangle does when the angle changes.
|
|
3
|
+
*
|
|
4
|
+
* The crop rect is normalised to the bounding box of the *rotated* image, not
|
|
5
|
+
* to the image (the core sizes the output as rect × rotated box). Left alone,
|
|
6
|
+
* a rect therefore covers more pixels the further the image is turned, and a
|
|
7
|
+
* rect that touches the box's edge takes in area outside the turned image.
|
|
8
|
+
* The two functions here decide the rect a change of angle should write, so
|
|
9
|
+
* the log still gets a plain `crop.set` with `rect` and `rotation`:
|
|
10
|
+
*
|
|
11
|
+
* - `straighten`: the slider. The frame stays where it is on the stage and
|
|
12
|
+
* keeps its size in pixels while the image turns behind it; then it shrinks
|
|
13
|
+
* about its centre, aspect kept, until every corner is inside the image.
|
|
14
|
+
* - `quarterTurn`: the ±90° buttons. The crop turns with the image, so the
|
|
15
|
+
* output is the previous output turned by a quarter.
|
|
16
|
+
*
|
|
17
|
+
* Positive angles turn clockwise on screen, as the core and CSS `rotate()` do.
|
|
18
|
+
*/
|
|
19
|
+
import type { Rect } from '@sealpixel/core';
|
|
20
|
+
export interface Size {
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}
|
|
24
|
+
/** Bounding box of `size` rotated by `angle` radians, in the same units. */
|
|
25
|
+
export declare function rotatedBox(size: Size, angle: number): Size;
|
|
26
|
+
/**
|
|
27
|
+
* The rect for a new angle: same frame on the stage, same size in pixels,
|
|
28
|
+
* then — with `constrain` — fitted inside the turned image. `image` is the
|
|
29
|
+
* source size in pixels; `margin` keeps the frame that far inside the image
|
|
30
|
+
* edge, in pixels, so the anti-aliased border of the turned image never
|
|
31
|
+
* enters the output.
|
|
32
|
+
*/
|
|
33
|
+
export declare function straighten(rect: Rect, from: number, to: number, image: Size, constrain?: boolean, margin?: number): Rect;
|
|
34
|
+
/**
|
|
35
|
+
* True when every corner of `rect` (normalised to the box of the image turned
|
|
36
|
+
* by `angle`) lies inside the turned image, `margin` pixels in.
|
|
37
|
+
*/
|
|
38
|
+
export declare function insideImage(rect: Rect, angle: number, image: Size, margin?: number): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* A drag that cannot take the frame out of the turned image. `apply` maps a
|
|
41
|
+
* delta to the rect a free drag would give. The largest share of the delta
|
|
42
|
+
* that stays inside is taken; from there each axis is extended on its own, so
|
|
43
|
+
* the frame slides along the image edge instead of sticking to it. A frame
|
|
44
|
+
* that starts outside is not held back: the user has to be able to bring it in.
|
|
45
|
+
*/
|
|
46
|
+
export declare function constrainDrag(apply: (dx: number, dy: number) => Rect, dx: number, dy: number, angle: number, image: Size, margin?: number): Rect;
|
|
47
|
+
/**
|
|
48
|
+
* A quarter turn of the crop with the image. `dir` is +1 for clockwise. The
|
|
49
|
+
* box's normalised coordinates turn with it: clockwise, a point (u, v)
|
|
50
|
+
* becomes (1 − v, u).
|
|
51
|
+
*/
|
|
52
|
+
export declare function quarterTurn(rect: Rect, dir: 1 | -1): Rect;
|
|
53
|
+
//# sourceMappingURL=crop-rotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop-rotation.d.ts","sourceRoot":"","sources":["../../src/tools/crop-rotation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAI1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,IAAI,EACX,SAAS,UAAO,EAChB,MAAM,SAAI,GACT,IAAI,CAiBN;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,SAAI,GAAG,OAAO,CAkBvF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,EACvC,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,IAAI,EACX,MAAM,SAAI,GACT,IAAI,CAqBN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAIzD"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/** Bounding box of `size` rotated by `angle` radians, in the same units. */
|
|
2
|
+
export function rotatedBox(size, angle) {
|
|
3
|
+
const s = Math.abs(Math.sin(angle));
|
|
4
|
+
const c = Math.abs(Math.cos(angle));
|
|
5
|
+
return { width: size.width * c + size.height * s, height: size.width * s + size.height * c };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The rect for a new angle: same frame on the stage, same size in pixels,
|
|
9
|
+
* then — with `constrain` — fitted inside the turned image. `image` is the
|
|
10
|
+
* source size in pixels; `margin` keeps the frame that far inside the image
|
|
11
|
+
* edge, in pixels, so the anti-aliased border of the turned image never
|
|
12
|
+
* enters the output.
|
|
13
|
+
*/
|
|
14
|
+
export function straighten(rect, from, to, image, constrain = true, margin = 1) {
|
|
15
|
+
const b0 = rotatedBox(image, from);
|
|
16
|
+
const b1 = rotatedBox(image, to);
|
|
17
|
+
// The frame in pixels: size, and centre offset from the box centre, which
|
|
18
|
+
// is the image centre in both boxes.
|
|
19
|
+
const pw = rect.width * b0.width;
|
|
20
|
+
const ph = rect.height * b0.height;
|
|
21
|
+
const ox = (rect.x + rect.width / 2) * b0.width - b0.width / 2;
|
|
22
|
+
const oy = (rect.y + rect.height / 2) * b0.height - b0.height / 2;
|
|
23
|
+
const frame = { x: ox, y: oy, width: pw, height: ph };
|
|
24
|
+
const fitted = constrain ? fitInside(frame, to, image, margin) : frame;
|
|
25
|
+
return {
|
|
26
|
+
x: (b1.width / 2 + fitted.x - fitted.width / 2) / b1.width,
|
|
27
|
+
y: (b1.height / 2 + fitted.y - fitted.height / 2) / b1.height,
|
|
28
|
+
width: fitted.width / b1.width,
|
|
29
|
+
height: fitted.height / b1.height,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* True when every corner of `rect` (normalised to the box of the image turned
|
|
34
|
+
* by `angle`) lies inside the turned image, `margin` pixels in.
|
|
35
|
+
*/
|
|
36
|
+
export function insideImage(rect, angle, image, margin = 1) {
|
|
37
|
+
const b = rotatedBox(image, angle);
|
|
38
|
+
const cos = Math.cos(angle);
|
|
39
|
+
const sin = Math.sin(angle);
|
|
40
|
+
const lx = image.width / 2 - margin;
|
|
41
|
+
const ly = image.height / 2 - margin;
|
|
42
|
+
for (const [u, v] of [
|
|
43
|
+
[rect.x, rect.y],
|
|
44
|
+
[rect.x + rect.width, rect.y],
|
|
45
|
+
[rect.x, rect.y + rect.height],
|
|
46
|
+
[rect.x + rect.width, rect.y + rect.height],
|
|
47
|
+
]) {
|
|
48
|
+
const x = u * b.width - b.width / 2;
|
|
49
|
+
const y = v * b.height - b.height / 2;
|
|
50
|
+
if (Math.abs(x * cos + y * sin) > lx + 1e-9 || Math.abs(-x * sin + y * cos) > ly + 1e-9)
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A drag that cannot take the frame out of the turned image. `apply` maps a
|
|
57
|
+
* delta to the rect a free drag would give. The largest share of the delta
|
|
58
|
+
* that stays inside is taken; from there each axis is extended on its own, so
|
|
59
|
+
* the frame slides along the image edge instead of sticking to it. A frame
|
|
60
|
+
* that starts outside is not held back: the user has to be able to bring it in.
|
|
61
|
+
*/
|
|
62
|
+
export function constrainDrag(apply, dx, dy, angle, image, margin = 1) {
|
|
63
|
+
const ok = (r) => insideImage(r, angle, image, margin);
|
|
64
|
+
const full = apply(dx, dy);
|
|
65
|
+
if (ok(full) || !ok(apply(0, 0)))
|
|
66
|
+
return full;
|
|
67
|
+
// The largest t in [0, 1] for which f(t) is inside; f(0) is.
|
|
68
|
+
const largest = (f) => {
|
|
69
|
+
let lo = 0;
|
|
70
|
+
let hi = 1;
|
|
71
|
+
for (let i = 0; i < 16; i++) {
|
|
72
|
+
const mid = (lo + hi) / 2;
|
|
73
|
+
if (ok(f(mid)))
|
|
74
|
+
lo = mid;
|
|
75
|
+
else
|
|
76
|
+
hi = mid;
|
|
77
|
+
}
|
|
78
|
+
return lo;
|
|
79
|
+
};
|
|
80
|
+
const t = largest((s) => apply(s * dx, s * dy));
|
|
81
|
+
const alongX = largest((s) => apply((t + s * (1 - t)) * dx, t * dy));
|
|
82
|
+
const alongY = largest((s) => apply(t * dx, (t + s * (1 - t)) * dy));
|
|
83
|
+
return alongX >= alongY
|
|
84
|
+
? apply((t + alongX * (1 - t)) * dx, t * dy)
|
|
85
|
+
: apply(t * dx, (t + alongY * (1 - t)) * dy);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A quarter turn of the crop with the image. `dir` is +1 for clockwise. The
|
|
89
|
+
* box's normalised coordinates turn with it: clockwise, a point (u, v)
|
|
90
|
+
* becomes (1 − v, u).
|
|
91
|
+
*/
|
|
92
|
+
export function quarterTurn(rect, dir) {
|
|
93
|
+
return dir === 1
|
|
94
|
+
? { x: 1 - (rect.y + rect.height), y: rect.x, width: rect.height, height: rect.width }
|
|
95
|
+
: { x: rect.y, y: 1 - (rect.x + rect.width), width: rect.height, height: rect.width };
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A frame given as centre offset from the image centre and size, all in
|
|
99
|
+
* pixels, moved and shrunk about its centre until it lies inside the image
|
|
100
|
+
* turned by `angle`. Solved in the image's own frame: the four corners are
|
|
101
|
+
* turned back by −angle and have to fall within ±width/2 and ±height/2.
|
|
102
|
+
*/
|
|
103
|
+
function fitInside(frame, angle, image, margin) {
|
|
104
|
+
const lx = Math.max(0, image.width / 2 - margin);
|
|
105
|
+
const ly = Math.max(0, image.height / 2 - margin);
|
|
106
|
+
const cos = Math.cos(angle);
|
|
107
|
+
const sin = Math.sin(angle);
|
|
108
|
+
// Turn a screen offset back into the unturned image's frame.
|
|
109
|
+
const back = (x, y) => ({ x: x * cos + y * sin, y: -x * sin + y * cos });
|
|
110
|
+
const forth = (x, y) => ({ x: x * cos - y * sin, y: x * sin + y * cos });
|
|
111
|
+
const hw = frame.width / 2;
|
|
112
|
+
const hh = frame.height / 2;
|
|
113
|
+
// The centre first. Inside the image, it stays and only the size gives —
|
|
114
|
+
// the frame shrinks in place. Outside, no scale helps: the frame moves in
|
|
115
|
+
// to where it fits whole, which is the image less the frame's own extent
|
|
116
|
+
// in the image's frame.
|
|
117
|
+
let a = back(frame.x, frame.y);
|
|
118
|
+
if (Math.abs(a.x) > lx || Math.abs(a.y) > ly) {
|
|
119
|
+
const ex = Math.abs(hw * cos) + Math.abs(hh * sin);
|
|
120
|
+
const ey = Math.abs(hw * sin) + Math.abs(hh * cos);
|
|
121
|
+
a = {
|
|
122
|
+
x: clamp(a.x, -Math.max(0, lx - ex), Math.max(0, lx - ex)),
|
|
123
|
+
y: clamp(a.y, -Math.max(0, ly - ey), Math.max(0, ly - ey)),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const centre = forth(a.x, a.y);
|
|
127
|
+
// Then the largest scale of the frame about that centre that keeps every
|
|
128
|
+
// corner inside: each corner and axis is one linear bound on the scale.
|
|
129
|
+
let scale = 1;
|
|
130
|
+
for (const [sx, sy] of [
|
|
131
|
+
[1, 1],
|
|
132
|
+
[1, -1],
|
|
133
|
+
[-1, 1],
|
|
134
|
+
[-1, -1],
|
|
135
|
+
]) {
|
|
136
|
+
const b = back(sx * hw, sy * hh);
|
|
137
|
+
for (const [pos, off, limit] of [
|
|
138
|
+
[a.x, b.x, lx],
|
|
139
|
+
[a.y, b.y, ly],
|
|
140
|
+
]) {
|
|
141
|
+
if (off > 1e-12)
|
|
142
|
+
scale = Math.min(scale, (limit - pos) / off);
|
|
143
|
+
else if (off < -1e-12)
|
|
144
|
+
scale = Math.min(scale, (-limit - pos) / off);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
scale = Math.max(0, scale);
|
|
148
|
+
return { x: centre.x, y: centre.y, width: frame.width * scale, height: frame.height * scale };
|
|
149
|
+
}
|
|
150
|
+
function clamp(v, lo, hi) {
|
|
151
|
+
return v < lo ? lo : v > hi ? hi : v;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=crop-rotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop-rotation.js","sourceRoot":"","sources":["../../src/tools/crop-rotation.ts"],"names":[],"mappings":"AAyBA,4EAA4E;AAC5E,MAAM,UAAU,UAAU,CAAC,IAAU,EAAE,KAAa;IAClD,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACpC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACpC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;AAC/F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,IAAU,EACV,IAAY,EACZ,EAAU,EACV,KAAW,EACX,SAAS,GAAG,IAAI,EAChB,MAAM,GAAG,CAAC;IAEV,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACnC,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjC,0EAA0E;IAC1E,qCAAqC;IACrC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;IACjC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,CA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CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;iBACzD,IAAI,GAAG,GAAG,CAAC,KAAK;gBAAE,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IACD,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;AAChG,CAAC;AAED,SAAS,KAAK,CAAC,CAAS,EAAE,EAAU,EAAE,EAAU;IAC9C,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/tools/crop.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crop.d.ts","sourceRoot":"","sources":["../../src/tools/crop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"crop.d.ts","sourceRoot":"","sources":["../../src/tools/crop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI/D,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,YAAY,CAAC;AAaxD,KAAK,MAAM,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,MAAM,CAAC;AA0HzE,eAAO,MAAM,QAAQ,EAAE,MAsQtB,CAAC;AAsBF;;;GAGG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,WAAW,EAAE,MAAM,GAClB,IAAI,CAyCN"}
|