@annotorious/svelte 3.0.8 → 3.0.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.
|
@@ -2,11 +2,11 @@ var it = Object.defineProperty;
|
|
|
2
2
|
var st = (e, t, n) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var pe = (e, t, n) => st(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { toSvelteStore as lt } from "@annotorious/core";
|
|
5
|
-
import { Origin as
|
|
6
|
-
import { ShapeType as
|
|
5
|
+
import { Origin as Vt, UserSelectAction as qt, createAnonymousGuest as zt, createBody as Wt, defaultColorProvider as $t } from "@annotorious/core";
|
|
6
|
+
import { ShapeType as Gt, W3CImageFormat as Jt, createImageAnnotator as Kt } from "@annotorious/annotorious";
|
|
7
7
|
import { createOSDAnnotator as ut } from "@annotorious/openseadragon";
|
|
8
8
|
import Pe from "openseadragon";
|
|
9
|
-
function
|
|
9
|
+
function j() {
|
|
10
10
|
}
|
|
11
11
|
function at(e, t) {
|
|
12
12
|
for (const n in t) e[n] = t[n];
|
|
@@ -15,14 +15,14 @@ function at(e, t) {
|
|
|
15
15
|
e
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function ze(e) {
|
|
19
19
|
return e();
|
|
20
20
|
}
|
|
21
21
|
function Oe() {
|
|
22
22
|
return /* @__PURE__ */ Object.create(null);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
e.forEach(
|
|
24
|
+
function H(e) {
|
|
25
|
+
e.forEach(ze);
|
|
26
26
|
}
|
|
27
27
|
function te(e) {
|
|
28
28
|
return typeof e == "function";
|
|
@@ -30,20 +30,20 @@ function te(e) {
|
|
|
30
30
|
function we(e, t) {
|
|
31
31
|
return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ft(e) {
|
|
34
34
|
return Object.keys(e).length === 0;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function ct(e, ...t) {
|
|
37
37
|
if (e == null) {
|
|
38
38
|
for (const o of t)
|
|
39
39
|
o(void 0);
|
|
40
|
-
return
|
|
40
|
+
return j;
|
|
41
41
|
}
|
|
42
42
|
const n = e.subscribe(...t);
|
|
43
43
|
return n.unsubscribe ? () => n.unsubscribe() : n;
|
|
44
44
|
}
|
|
45
45
|
function We(e, t, n) {
|
|
46
|
-
e.$$.on_destroy.push(
|
|
46
|
+
e.$$.on_destroy.push(ct(t, n));
|
|
47
47
|
}
|
|
48
48
|
function $e(e, t, n, o) {
|
|
49
49
|
if (e) {
|
|
@@ -85,7 +85,7 @@ function Ke(e) {
|
|
|
85
85
|
return -1;
|
|
86
86
|
}
|
|
87
87
|
function dt(e) {
|
|
88
|
-
return e && te(e.destroy) ? e.destroy :
|
|
88
|
+
return e && te(e.destroy) ? e.destroy : j;
|
|
89
89
|
}
|
|
90
90
|
function pt(e, t) {
|
|
91
91
|
e.appendChild(t);
|
|
@@ -105,7 +105,7 @@ function Ze(e) {
|
|
|
105
105
|
function Ee() {
|
|
106
106
|
return Ze("");
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Be(e, t, n, o) {
|
|
109
109
|
return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o);
|
|
110
110
|
}
|
|
111
111
|
function Z(e, t, n) {
|
|
@@ -122,105 +122,105 @@ let $;
|
|
|
122
122
|
function W(e) {
|
|
123
123
|
$ = e;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function Se() {
|
|
126
126
|
if (!$) throw new Error("Function called outside component initialization");
|
|
127
127
|
return $;
|
|
128
128
|
}
|
|
129
129
|
function et(e) {
|
|
130
|
-
|
|
130
|
+
Se().$$.on_mount.push(e);
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
return
|
|
132
|
+
function je(e, t) {
|
|
133
|
+
return Se().$$.context.set(e, t), t;
|
|
134
134
|
}
|
|
135
135
|
function mt(e) {
|
|
136
|
-
return
|
|
136
|
+
return Se().$$.context.get(e);
|
|
137
137
|
}
|
|
138
|
-
const
|
|
139
|
-
let
|
|
140
|
-
const
|
|
138
|
+
const R = [], Te = [];
|
|
139
|
+
let X = [];
|
|
140
|
+
const Ie = [], _t = /* @__PURE__ */ Promise.resolve();
|
|
141
141
|
let ye = !1;
|
|
142
142
|
function yt() {
|
|
143
143
|
ye || (ye = !0, _t.then(tt));
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
145
|
+
function ve(e) {
|
|
146
|
+
X.push(e);
|
|
147
147
|
}
|
|
148
148
|
const ge = /* @__PURE__ */ new Set();
|
|
149
|
-
let
|
|
149
|
+
let I = 0;
|
|
150
150
|
function tt() {
|
|
151
|
-
if (
|
|
151
|
+
if (I !== 0)
|
|
152
152
|
return;
|
|
153
153
|
const e = $;
|
|
154
154
|
do {
|
|
155
155
|
try {
|
|
156
|
-
for (;
|
|
157
|
-
const t =
|
|
158
|
-
|
|
156
|
+
for (; I < R.length; ) {
|
|
157
|
+
const t = R[I];
|
|
158
|
+
I++, W(t), vt(t.$$);
|
|
159
159
|
}
|
|
160
160
|
} catch (t) {
|
|
161
|
-
throw
|
|
161
|
+
throw R.length = 0, I = 0, t;
|
|
162
162
|
}
|
|
163
|
-
for (W(null),
|
|
164
|
-
for (let t = 0; t <
|
|
165
|
-
const n =
|
|
163
|
+
for (W(null), R.length = 0, I = 0; Te.length; ) Te.pop()();
|
|
164
|
+
for (let t = 0; t < X.length; t += 1) {
|
|
165
|
+
const n = X[t];
|
|
166
166
|
ge.has(n) || (ge.add(n), n());
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
} while (
|
|
170
|
-
for (;
|
|
171
|
-
|
|
168
|
+
X.length = 0;
|
|
169
|
+
} while (R.length);
|
|
170
|
+
for (; Ie.length; )
|
|
171
|
+
Ie.pop()();
|
|
172
172
|
ye = !1, ge.clear(), W(e);
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function vt(e) {
|
|
175
175
|
if (e.fragment !== null) {
|
|
176
|
-
e.update(),
|
|
176
|
+
e.update(), H(e.before_update);
|
|
177
177
|
const t = e.dirty;
|
|
178
|
-
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(
|
|
178
|
+
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(ve);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function bt(e) {
|
|
182
182
|
const t = [], n = [];
|
|
183
|
-
|
|
183
|
+
X.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), X = t;
|
|
184
184
|
}
|
|
185
185
|
const ee = /* @__PURE__ */ new Set();
|
|
186
|
-
let
|
|
186
|
+
let B;
|
|
187
187
|
function nt() {
|
|
188
|
-
|
|
188
|
+
B = {
|
|
189
189
|
r: 0,
|
|
190
190
|
c: [],
|
|
191
|
-
p:
|
|
191
|
+
p: B
|
|
192
192
|
// parent group
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
function ot() {
|
|
196
|
-
|
|
196
|
+
B.r || H(B.c), B = B.p;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function D(e, t) {
|
|
199
199
|
e && e.i && (ee.delete(e), e.i(t));
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function Y(e, t, n, o) {
|
|
202
202
|
if (e && e.o) {
|
|
203
203
|
if (ee.has(e)) return;
|
|
204
|
-
ee.add(e),
|
|
204
|
+
ee.add(e), B.c.push(() => {
|
|
205
205
|
ee.delete(e), o && (n && e.d(1), o());
|
|
206
206
|
}), e.o(t);
|
|
207
207
|
} else o && o();
|
|
208
208
|
}
|
|
209
209
|
function wt(e, t, n) {
|
|
210
210
|
const { fragment: o, after_update: r } = e.$$;
|
|
211
|
-
o && o.m(t, n),
|
|
212
|
-
const i = e.$$.on_mount.map(
|
|
213
|
-
e.$$.on_destroy ? e.$$.on_destroy.push(...i) :
|
|
214
|
-
}), r.forEach(
|
|
211
|
+
o && o.m(t, n), ve(() => {
|
|
212
|
+
const i = e.$$.on_mount.map(ze).filter(te);
|
|
213
|
+
e.$$.on_destroy ? e.$$.on_destroy.push(...i) : H(i), e.$$.on_mount = [];
|
|
214
|
+
}), r.forEach(ve);
|
|
215
215
|
}
|
|
216
216
|
function Et(e, t) {
|
|
217
217
|
const n = e.$$;
|
|
218
|
-
n.fragment !== null && (
|
|
218
|
+
n.fragment !== null && (bt(n.after_update), H(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
e.$$.dirty[0] === -1 && (
|
|
220
|
+
function St(e, t) {
|
|
221
|
+
e.$$.dirty[0] === -1 && (R.push(e), yt(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function xe(e, t, n, o, r, i, s = null, u = [-1]) {
|
|
224
224
|
const d = $;
|
|
225
225
|
W(e);
|
|
226
226
|
const a = e.$$ = {
|
|
@@ -228,7 +228,7 @@ function Se(e, t, n, o, r, i, s = null, u = [-1]) {
|
|
|
228
228
|
ctx: [],
|
|
229
229
|
// state
|
|
230
230
|
props: i,
|
|
231
|
-
update:
|
|
231
|
+
update: j,
|
|
232
232
|
not_equal: r,
|
|
233
233
|
bound: Oe(),
|
|
234
234
|
// lifecycle
|
|
@@ -246,16 +246,16 @@ function Se(e, t, n, o, r, i, s = null, u = [-1]) {
|
|
|
246
246
|
};
|
|
247
247
|
s && s(a.root);
|
|
248
248
|
let y = !1;
|
|
249
|
-
if (a.ctx = n ? n(e, t.props || {}, (g, m, ...
|
|
250
|
-
const
|
|
251
|
-
return a.ctx && r(a.ctx[g], a.ctx[g] =
|
|
252
|
-
}) : [], a.update(), y = !0,
|
|
249
|
+
if (a.ctx = n ? n(e, t.props || {}, (g, m, ...b) => {
|
|
250
|
+
const f = b.length ? b[0] : m;
|
|
251
|
+
return a.ctx && r(a.ctx[g], a.ctx[g] = f) && (!a.skip_bound && a.bound[g] && a.bound[g](f), y && St(e, g)), m;
|
|
252
|
+
}) : [], a.update(), y = !0, H(a.before_update), a.fragment = o ? o(a.ctx) : !1, t.target) {
|
|
253
253
|
if (t.hydrate) {
|
|
254
254
|
const g = gt(t.target);
|
|
255
255
|
a.fragment && a.fragment.l(g), g.forEach(U);
|
|
256
256
|
} else
|
|
257
257
|
a.fragment && a.fragment.c();
|
|
258
|
-
t.intro &&
|
|
258
|
+
t.intro && D(e.$$.fragment), wt(e, t.target, t.anchor), tt();
|
|
259
259
|
}
|
|
260
260
|
W(d);
|
|
261
261
|
}
|
|
@@ -280,7 +280,7 @@ class Ae {
|
|
|
280
280
|
}
|
|
281
281
|
/** @returns {void} */
|
|
282
282
|
$destroy() {
|
|
283
|
-
Et(this, 1), this.$destroy =
|
|
283
|
+
Et(this, 1), this.$destroy = j;
|
|
284
284
|
}
|
|
285
285
|
/**
|
|
286
286
|
* @template {Extract<keyof Events, string>} K
|
|
@@ -290,7 +290,7 @@ class Ae {
|
|
|
290
290
|
*/
|
|
291
291
|
$on(t, n) {
|
|
292
292
|
if (!te(n))
|
|
293
|
-
return
|
|
293
|
+
return j;
|
|
294
294
|
const o = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
|
|
295
295
|
return o.push(n), () => {
|
|
296
296
|
const r = o.indexOf(n);
|
|
@@ -302,10 +302,12 @@ class Ae {
|
|
|
302
302
|
* @returns {void}
|
|
303
303
|
*/
|
|
304
304
|
$set(t) {
|
|
305
|
-
this.$$set && !
|
|
305
|
+
this.$$set && !ft(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
|
|
308
|
+
const xt = "4";
|
|
309
|
+
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(xt);
|
|
310
|
+
function Re(e) {
|
|
309
311
|
let t;
|
|
310
312
|
const n = (
|
|
311
313
|
/*#slots*/
|
|
@@ -346,20 +348,20 @@ function Xe(e) {
|
|
|
346
348
|
);
|
|
347
349
|
},
|
|
348
350
|
i(r) {
|
|
349
|
-
t || (
|
|
351
|
+
t || (D(o, r), t = !0);
|
|
350
352
|
},
|
|
351
353
|
o(r) {
|
|
352
|
-
|
|
354
|
+
Y(o, r), t = !1;
|
|
353
355
|
},
|
|
354
356
|
d(r) {
|
|
355
357
|
o && o.d(r);
|
|
356
358
|
}
|
|
357
359
|
};
|
|
358
360
|
}
|
|
359
|
-
function
|
|
361
|
+
function At(e) {
|
|
360
362
|
let t, n, o = (
|
|
361
363
|
/*viewer*/
|
|
362
|
-
e[0] &&
|
|
364
|
+
e[0] && Re(e)
|
|
363
365
|
);
|
|
364
366
|
return {
|
|
365
367
|
c() {
|
|
@@ -371,22 +373,22 @@ function St(e) {
|
|
|
371
373
|
p(r, [i]) {
|
|
372
374
|
/*viewer*/
|
|
373
375
|
r[0] ? o ? (o.p(r, i), i & /*viewer*/
|
|
374
|
-
1 &&
|
|
376
|
+
1 && D(o, 1)) : (o = Re(r), o.c(), D(o, 1), o.m(t.parentNode, t)) : o && (nt(), Y(o, 1, 1, () => {
|
|
375
377
|
o = null;
|
|
376
378
|
}), ot());
|
|
377
379
|
},
|
|
378
380
|
i(r) {
|
|
379
|
-
n || (
|
|
381
|
+
n || (D(o), n = !0);
|
|
380
382
|
},
|
|
381
383
|
o(r) {
|
|
382
|
-
|
|
384
|
+
Y(o), n = !1;
|
|
383
385
|
},
|
|
384
386
|
d(r) {
|
|
385
387
|
r && U(t), o && o.d(r);
|
|
386
388
|
}
|
|
387
389
|
};
|
|
388
390
|
}
|
|
389
|
-
function
|
|
391
|
+
function Ct(e, t, n) {
|
|
390
392
|
let { $$slots: o = {}, $$scope: r } = t, { viewer: i } = t, { opts: s = {} } = t, { anno: u = void 0 } = t;
|
|
391
393
|
const d = (a) => {
|
|
392
394
|
if (a) {
|
|
@@ -394,7 +396,7 @@ function At(e, t, n) {
|
|
|
394
396
|
...y,
|
|
395
397
|
state: { ...y.state, store: g }
|
|
396
398
|
};
|
|
397
|
-
|
|
399
|
+
je("anno", m), je("viewer", a), n(1, u = m);
|
|
398
400
|
}
|
|
399
401
|
};
|
|
400
402
|
return e.$$set = (a) => {
|
|
@@ -406,16 +408,16 @@ function At(e, t, n) {
|
|
|
406
408
|
}
|
|
407
409
|
class Rt extends Ae {
|
|
408
410
|
constructor(t) {
|
|
409
|
-
super(),
|
|
411
|
+
super(), xe(this, t, Ct, At, we, { viewer: 0, opts: 2, anno: 1 });
|
|
410
412
|
}
|
|
411
413
|
}
|
|
412
|
-
var he = { dragStart: !0 },
|
|
414
|
+
var he = { dragStart: !0 }, Xe = (e, t, n) => Math.min(Math.max(e, t), n), me = (e) => typeof e == "string", Nt = ([e, t], n, o) => {
|
|
413
415
|
const r = (i, s) => s === 0 ? 0 : Math.ceil(i / s) * s;
|
|
414
416
|
return [r(n, e), r(o, t)];
|
|
415
|
-
},
|
|
417
|
+
}, Ye = (e, t) => e.some((n) => t.some((o) => n.contains(o)));
|
|
416
418
|
function _e(e, t) {
|
|
417
419
|
if (e === void 0) return;
|
|
418
|
-
if (
|
|
420
|
+
if (be(e)) return e.getBoundingClientRect();
|
|
419
421
|
if (typeof e == "object") {
|
|
420
422
|
const { top: o = 0, left: r = 0, right: i = 0, bottom: s = 0 } = e;
|
|
421
423
|
return { top: o, right: window.innerWidth - i, bottom: window.innerHeight - s, left: r };
|
|
@@ -425,93 +427,93 @@ function _e(e, t) {
|
|
|
425
427
|
if (n === null) throw new Error("The selector provided for bound doesn't exists in the document.");
|
|
426
428
|
return n.getBoundingClientRect();
|
|
427
429
|
}
|
|
428
|
-
var Q = (e, t, n) => e.style.setProperty(t, n),
|
|
429
|
-
let n, o, { bounds: r, axis: i = "both", gpuAcceleration: s = !0, legacyTranslate: u = !0, transform: d, applyUserSelectHack: a = !0, disabled: y = !1, ignoreMultitouch: g = !1, recomputeBounds: m = he, grid:
|
|
430
|
-
|
|
431
|
-
let
|
|
430
|
+
var Q = (e, t, n) => e.style.setProperty(t, n), be = (e) => e instanceof HTMLElement, kt = (e, t = {}) => {
|
|
431
|
+
let n, o, { bounds: r, axis: i = "both", gpuAcceleration: s = !0, legacyTranslate: u = !0, transform: d, applyUserSelectHack: a = !0, disabled: y = !1, ignoreMultitouch: g = !1, recomputeBounds: m = he, grid: b, position: f, cancel: A, handle: w, defaultClass: c = "neodrag", defaultClassDragging: x = "neodrag-dragging", defaultClassDragged: C = "neodrag-dragged", defaultPosition: ne = { x: 0, y: 0 }, onDragStart: oe, onDrag: re, onDragEnd: ie } = t, T = !1, N = 0, k = 0, V = 0, q = 0, se = 0, le = 0, { x: G, y: J } = f ? { x: (f == null ? void 0 : f.x) ?? 0, y: (f == null ? void 0 : f.y) ?? 0 } : ne;
|
|
432
|
+
fe(G, J);
|
|
433
|
+
let L, O, z, ue, Ce, Ne = "", rt = !!f;
|
|
432
434
|
m = { ...he, ...m };
|
|
433
435
|
let K = /* @__PURE__ */ new Set();
|
|
434
436
|
const ae = document.body.style, P = e.classList;
|
|
435
|
-
function
|
|
437
|
+
function fe(l = N, h = k) {
|
|
436
438
|
if (!d) {
|
|
437
439
|
if (u) {
|
|
438
|
-
let
|
|
439
|
-
return Q(e, "transform", s ? `translate3d(${
|
|
440
|
+
let v = `${+l}px, ${+h}px`;
|
|
441
|
+
return Q(e, "transform", s ? `translate3d(${v}, 0)` : `translate(${v})`);
|
|
440
442
|
}
|
|
441
443
|
return Q(e, "translate", `${+l}px ${+h}px ${s ? "1px" : ""}`);
|
|
442
444
|
}
|
|
443
445
|
const _ = d({ offsetX: l, offsetY: h, rootNode: e });
|
|
444
446
|
me(_) && Q(e, "transform", _);
|
|
445
447
|
}
|
|
446
|
-
const
|
|
448
|
+
const ce = (l, h) => {
|
|
447
449
|
const _ = { offsetX: N, offsetY: k, rootNode: e, currentNode: Ce };
|
|
448
450
|
e.dispatchEvent(new CustomEvent(l, { detail: _ })), h == null || h(_);
|
|
449
451
|
}, de = addEventListener;
|
|
450
|
-
de("pointerdown",
|
|
452
|
+
de("pointerdown", Le, !1), de("pointerup", Me, !1), de("pointermove", De, !1), Q(e, "touch-action", "none");
|
|
451
453
|
const ke = () => {
|
|
452
454
|
let l = e.offsetWidth / O.width;
|
|
453
455
|
return isNaN(l) && (l = 1), l;
|
|
454
456
|
};
|
|
455
|
-
function
|
|
457
|
+
function Le(l) {
|
|
456
458
|
if (y || l.button === 2) return;
|
|
457
459
|
if (K.add(l.pointerId), g && K.size > 1) return l.preventDefault();
|
|
458
|
-
if (m.dragStart && (
|
|
459
|
-
if (P.add(
|
|
460
|
-
if (!p) return [
|
|
461
|
-
if (
|
|
460
|
+
if (m.dragStart && (L = _e(r, e)), me(w) && me(A) && w === A) throw new Error("`handle` selector can't be same as `cancel` selector");
|
|
461
|
+
if (P.add(c), z = function(p, S) {
|
|
462
|
+
if (!p) return [S];
|
|
463
|
+
if (be(p)) return [p];
|
|
462
464
|
if (Array.isArray(p)) return p;
|
|
463
|
-
const
|
|
464
|
-
if (
|
|
465
|
-
return Array.from(
|
|
466
|
-
}(w, e), ue = function(p,
|
|
465
|
+
const M = S.querySelectorAll(p);
|
|
466
|
+
if (M === null) throw new Error("Selector passed for `handle` option should be child of the element on which the action is applied");
|
|
467
|
+
return Array.from(M.values());
|
|
468
|
+
}(w, e), ue = function(p, S) {
|
|
467
469
|
if (!p) return [];
|
|
468
|
-
if (
|
|
470
|
+
if (be(p)) return [p];
|
|
469
471
|
if (Array.isArray(p)) return p;
|
|
470
|
-
const
|
|
471
|
-
if (
|
|
472
|
-
return Array.from(
|
|
473
|
-
}(A, e), n = /(both|x)/.test(i), o = /(both|y)/.test(i),
|
|
472
|
+
const M = S.querySelectorAll(p);
|
|
473
|
+
if (M === null) throw new Error("Selector passed for `cancel` option should be child of the element on which the action is applied");
|
|
474
|
+
return Array.from(M.values());
|
|
475
|
+
}(A, e), n = /(both|x)/.test(i), o = /(both|y)/.test(i), Ye(ue, z)) throw new Error("Element being dragged can't be a child of the element on which `cancel` is applied");
|
|
474
476
|
const h = l.composedPath()[0];
|
|
475
|
-
if (!
|
|
476
|
-
var
|
|
477
|
-
return p.contains(h) || ((
|
|
478
|
-
}) ||
|
|
479
|
-
Ce =
|
|
480
|
-
const { clientX: _, clientY:
|
|
481
|
-
n && (
|
|
477
|
+
if (!z.some((p) => {
|
|
478
|
+
var S;
|
|
479
|
+
return p.contains(h) || ((S = p.shadowRoot) == null ? void 0 : S.contains(h));
|
|
480
|
+
}) || Ye(ue, [h])) return;
|
|
481
|
+
Ce = z.length === 1 ? e : z.find((p) => p.contains(h)), T = !0, O = e.getBoundingClientRect(), a && (Ne = ae.userSelect, ae.userSelect = "none"), ce("neodrag:start", oe);
|
|
482
|
+
const { clientX: _, clientY: v } = l, E = ke();
|
|
483
|
+
n && (V = _ - G / E), o && (q = v - J / E), L && (se = _ - O.left, le = v - O.top);
|
|
482
484
|
}
|
|
483
|
-
function
|
|
484
|
-
K.delete(l.pointerId), T && (m.dragEnd && (
|
|
485
|
+
function Me(l) {
|
|
486
|
+
K.delete(l.pointerId), T && (m.dragEnd && (L = _e(r, e)), P.remove(x), P.add(C), a && (ae.userSelect = Ne), ce("neodrag:end", ie), n && (V = N), o && (q = k), T = !1);
|
|
485
487
|
}
|
|
486
|
-
function
|
|
488
|
+
function De(l) {
|
|
487
489
|
if (!T || g && K.size > 1) return;
|
|
488
|
-
m.drag && (
|
|
490
|
+
m.drag && (L = _e(r, e)), P.add(x), l.preventDefault(), O = e.getBoundingClientRect();
|
|
489
491
|
let h = l.clientX, _ = l.clientY;
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
492
|
-
const E = { left:
|
|
493
|
-
h =
|
|
492
|
+
const v = ke();
|
|
493
|
+
if (L) {
|
|
494
|
+
const E = { left: L.left + se, top: L.top + le, right: L.right + se - O.width, bottom: L.bottom + le - O.height };
|
|
495
|
+
h = Xe(h, E.left, E.right), _ = Xe(_, E.top, E.bottom);
|
|
494
496
|
}
|
|
495
|
-
if (Array.isArray(
|
|
496
|
-
let [E, p] =
|
|
497
|
+
if (Array.isArray(b)) {
|
|
498
|
+
let [E, p] = b;
|
|
497
499
|
if (isNaN(+E) || E < 0) throw new Error("1st argument of `grid` must be a valid positive number");
|
|
498
500
|
if (isNaN(+p) || p < 0) throw new Error("2nd argument of `grid` must be a valid positive number");
|
|
499
|
-
let
|
|
500
|
-
[
|
|
501
|
+
let S = h - V, M = _ - q;
|
|
502
|
+
[S, M] = Nt([E / v, p / v], S, M), h = V + S, _ = q + M;
|
|
501
503
|
}
|
|
502
|
-
n && (N = Math.round((h -
|
|
504
|
+
n && (N = Math.round((h - V) * v)), o && (k = Math.round((_ - q) * v)), G = N, J = k, ce("neodrag", re), fe();
|
|
503
505
|
}
|
|
504
506
|
return { destroy: () => {
|
|
505
507
|
const l = removeEventListener;
|
|
506
|
-
l("pointerdown",
|
|
508
|
+
l("pointerdown", Le, !1), l("pointerup", Me, !1), l("pointermove", De, !1);
|
|
507
509
|
}, update: (l) => {
|
|
508
|
-
var _,
|
|
509
|
-
i = l.axis || "both", y = l.disabled ?? !1, g = l.ignoreMultitouch ?? !1, w = l.handle, r = l.bounds, m = l.recomputeBounds ?? he, A = l.cancel, a = l.applyUserSelectHack ?? !0,
|
|
510
|
+
var _, v;
|
|
511
|
+
i = l.axis || "both", y = l.disabled ?? !1, g = l.ignoreMultitouch ?? !1, w = l.handle, r = l.bounds, m = l.recomputeBounds ?? he, A = l.cancel, a = l.applyUserSelectHack ?? !0, b = l.grid, s = l.gpuAcceleration ?? !0, u = l.legacyTranslate ?? !0, d = l.transform;
|
|
510
512
|
const h = P.contains(C);
|
|
511
|
-
P.remove(
|
|
513
|
+
P.remove(c, C), c = l.defaultClass ?? "neodrag", x = l.defaultClassDragging ?? "neodrag-dragging", C = l.defaultClassDragged ?? "neodrag-dragged", P.add(c), h && P.add(C), rt && (G = N = ((_ = l.position) == null ? void 0 : _.x) ?? N, J = k = ((v = l.position) == null ? void 0 : v.y) ?? k, fe());
|
|
512
514
|
} };
|
|
513
515
|
};
|
|
514
|
-
function
|
|
516
|
+
function He(e) {
|
|
515
517
|
let t, n = (
|
|
516
518
|
/*$selection*/
|
|
517
519
|
e[0].selected.map(Ue).join(", ") + ""
|
|
@@ -522,7 +524,7 @@ function Ie(e) {
|
|
|
522
524
|
},
|
|
523
525
|
m(u, d) {
|
|
524
526
|
F(u, t, d), pt(t, o), i || (s = [
|
|
525
|
-
dt(r =
|
|
527
|
+
dt(r = kt.call(null, t, {
|
|
526
528
|
position: { x: (
|
|
527
529
|
/*left*/
|
|
528
530
|
e[1]
|
|
@@ -531,13 +533,13 @@ function Ie(e) {
|
|
|
531
533
|
e[2]
|
|
532
534
|
) }
|
|
533
535
|
})),
|
|
534
|
-
|
|
536
|
+
Be(
|
|
535
537
|
t,
|
|
536
538
|
"neodrag:start",
|
|
537
539
|
/*onDragStart*/
|
|
538
540
|
e[4]
|
|
539
541
|
),
|
|
540
|
-
|
|
542
|
+
Be(
|
|
541
543
|
t,
|
|
542
544
|
"neodrag:end",
|
|
543
545
|
/*onDragEnd*/
|
|
@@ -560,14 +562,14 @@ function Ie(e) {
|
|
|
560
562
|
});
|
|
561
563
|
},
|
|
562
564
|
d(u) {
|
|
563
|
-
u && U(t), i = !1,
|
|
565
|
+
u && U(t), i = !1, H(s);
|
|
564
566
|
}
|
|
565
567
|
};
|
|
566
568
|
}
|
|
567
|
-
function
|
|
569
|
+
function Lt(e) {
|
|
568
570
|
let t, n = (
|
|
569
571
|
/*$selection*/
|
|
570
|
-
e[0] &&
|
|
572
|
+
e[0] && He(e)
|
|
571
573
|
);
|
|
572
574
|
return {
|
|
573
575
|
c() {
|
|
@@ -578,10 +580,10 @@ function kt(e) {
|
|
|
578
580
|
},
|
|
579
581
|
p(o, [r]) {
|
|
580
582
|
/*$selection*/
|
|
581
|
-
o[0] ? n ? n.p(o, r) : (n =
|
|
583
|
+
o[0] ? n ? n.p(o, r) : (n = He(o), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
|
|
582
584
|
},
|
|
583
|
-
i:
|
|
584
|
-
o:
|
|
585
|
+
i: j,
|
|
586
|
+
o: j,
|
|
585
587
|
d(o) {
|
|
586
588
|
o && U(t), n && n.d(o);
|
|
587
589
|
}
|
|
@@ -591,49 +593,49 @@ const Ue = (e) => e.id;
|
|
|
591
593
|
function Mt(e, t, n) {
|
|
592
594
|
let o, { state: r } = t, { viewer: i } = t, s, u, d = !1, a;
|
|
593
595
|
const { selection: y, store: g } = r;
|
|
594
|
-
We(e, y, (
|
|
595
|
-
const m = (
|
|
596
|
-
var
|
|
597
|
-
return ((
|
|
598
|
-
},
|
|
596
|
+
We(e, y, (c) => n(0, o = c));
|
|
597
|
+
const m = (c) => {
|
|
598
|
+
var x;
|
|
599
|
+
return ((x = c.selected) == null ? void 0 : x.length) > 0;
|
|
600
|
+
}, b = () => {
|
|
599
601
|
d = !0, i.setMouseNavEnabled(!1);
|
|
600
|
-
},
|
|
602
|
+
}, f = () => {
|
|
601
603
|
i.setMouseNavEnabled(!0);
|
|
602
604
|
}, A = () => {
|
|
603
|
-
a && g.unobserve(a), m(o) && (d = !1, w(o), a = (
|
|
605
|
+
a && g.unobserve(a), m(o) && (d = !1, w(o), a = (c) => {
|
|
604
606
|
d || w(o);
|
|
605
607
|
}, g.observe(a, {
|
|
606
|
-
annotations: o.selected.map((
|
|
608
|
+
annotations: o.selected.map((c) => c.id)
|
|
607
609
|
}));
|
|
608
|
-
}, w = (
|
|
609
|
-
const
|
|
610
|
+
}, w = (c) => {
|
|
611
|
+
const x = c.selected[0].id, C = g.getAnnotation(x), { minX: ne, minY: oe, maxX: re, maxY: ie } = C.target.selector.geometry.bounds, T = 14, N = i.viewport.imageToViewerElementCoordinates(new Pe.Point(ne, oe)), k = i.viewport.imageToViewerElementCoordinates(new Pe.Point(re, ie));
|
|
610
612
|
n(1, s = k.x + T), n(2, u = N.y);
|
|
611
613
|
};
|
|
612
614
|
return et(() => {
|
|
613
|
-
const
|
|
615
|
+
const c = () => {
|
|
614
616
|
m(o) && !d && w(o);
|
|
615
617
|
};
|
|
616
|
-
return i.addHandler("update-viewport",
|
|
617
|
-
i.removeHandler("update-viewport",
|
|
618
|
+
return i.addHandler("update-viewport", c), () => {
|
|
619
|
+
i.removeHandler("update-viewport", c);
|
|
618
620
|
};
|
|
619
|
-
}), e.$$set = (
|
|
620
|
-
"state" in
|
|
621
|
+
}), e.$$set = (c) => {
|
|
622
|
+
"state" in c && n(6, r = c.state), "viewer" in c && n(7, i = c.viewer);
|
|
621
623
|
}, e.$$.update = () => {
|
|
622
624
|
e.$$.dirty & /*$selection*/
|
|
623
625
|
1 && A();
|
|
624
|
-
}, [o, s, u, y,
|
|
626
|
+
}, [o, s, u, y, b, f, r, i];
|
|
625
627
|
}
|
|
626
628
|
class Xt extends Ae {
|
|
627
629
|
constructor(t) {
|
|
628
|
-
super(),
|
|
630
|
+
super(), xe(this, t, Mt, Lt, we, { state: 6, viewer: 7 });
|
|
629
631
|
}
|
|
630
632
|
}
|
|
631
633
|
const Dt = (e) => ({ hovered: e & /*hovered*/
|
|
632
|
-
16 }),
|
|
634
|
+
16 }), Ve = (e) => ({ hovered: (
|
|
633
635
|
/*hovered*/
|
|
634
636
|
e[4]
|
|
635
637
|
) });
|
|
636
|
-
function
|
|
638
|
+
function qe(e) {
|
|
637
639
|
let t, n, o;
|
|
638
640
|
const r = (
|
|
639
641
|
/*#slots*/
|
|
@@ -643,7 +645,7 @@ function ze(e) {
|
|
|
643
645
|
e,
|
|
644
646
|
/*$$scope*/
|
|
645
647
|
e[7],
|
|
646
|
-
|
|
648
|
+
Ve
|
|
647
649
|
);
|
|
648
650
|
return {
|
|
649
651
|
c() {
|
|
@@ -672,28 +674,28 @@ function ze(e) {
|
|
|
672
674
|
/*$$scope*/
|
|
673
675
|
s[7]
|
|
674
676
|
),
|
|
675
|
-
|
|
677
|
+
Ve
|
|
676
678
|
), (!o || u & /*left, top*/
|
|
677
679
|
6 && n !== (n = `left:${/*left*/
|
|
678
680
|
s[2]}px; top:${/*top*/
|
|
679
681
|
s[1]}px; position: absolute;`)) && Z(t, "style", n);
|
|
680
682
|
},
|
|
681
683
|
i(s) {
|
|
682
|
-
o || (
|
|
684
|
+
o || (D(i, s), o = !0);
|
|
683
685
|
},
|
|
684
686
|
o(s) {
|
|
685
|
-
|
|
687
|
+
Y(i, s), o = !1;
|
|
686
688
|
},
|
|
687
689
|
d(s) {
|
|
688
690
|
s && U(t), i && i.d(s);
|
|
689
691
|
}
|
|
690
692
|
};
|
|
691
693
|
}
|
|
692
|
-
function
|
|
694
|
+
function Pt(e) {
|
|
693
695
|
let t, n, o = (
|
|
694
696
|
/*$hover*/
|
|
695
697
|
e[0] && /*show*/
|
|
696
|
-
e[3] &&
|
|
698
|
+
e[3] && qe(e)
|
|
697
699
|
);
|
|
698
700
|
return {
|
|
699
701
|
c() {
|
|
@@ -706,61 +708,61 @@ function Lt(e) {
|
|
|
706
708
|
/*$hover*/
|
|
707
709
|
r[0] && /*show*/
|
|
708
710
|
r[3] ? o ? (o.p(r, i), i & /*$hover, show*/
|
|
709
|
-
9 &&
|
|
711
|
+
9 && D(o, 1)) : (o = qe(r), o.c(), D(o, 1), o.m(t.parentNode, t)) : o && (nt(), Y(o, 1, 1, () => {
|
|
710
712
|
o = null;
|
|
711
713
|
}), ot());
|
|
712
714
|
},
|
|
713
715
|
i(r) {
|
|
714
|
-
n || (
|
|
716
|
+
n || (D(o), n = !0);
|
|
715
717
|
},
|
|
716
718
|
o(r) {
|
|
717
|
-
|
|
719
|
+
Y(o), n = !1;
|
|
718
720
|
},
|
|
719
721
|
d(r) {
|
|
720
722
|
r && U(t), o && o.d(r);
|
|
721
723
|
}
|
|
722
724
|
};
|
|
723
725
|
}
|
|
724
|
-
function
|
|
726
|
+
function Ot(e, t, n) {
|
|
725
727
|
let o, r, { $$slots: i = {}, $$scope: s } = t, { container: u } = t;
|
|
726
728
|
const d = mt("anno"), { store: a, hover: y } = d.state;
|
|
727
|
-
We(e, y, (
|
|
728
|
-
let g, m,
|
|
729
|
+
We(e, y, (f) => n(0, r = f));
|
|
730
|
+
let g, m, b = !0;
|
|
729
731
|
return et(() => {
|
|
730
|
-
const
|
|
731
|
-
n(3,
|
|
732
|
-
}, A = (
|
|
733
|
-
const { offsetX:
|
|
734
|
-
n(2, m =
|
|
732
|
+
const f = () => {
|
|
733
|
+
n(3, b = !0);
|
|
734
|
+
}, A = (c) => {
|
|
735
|
+
const { offsetX: x, offsetY: C } = c;
|
|
736
|
+
n(2, m = x), n(1, g = C);
|
|
735
737
|
}, w = () => {
|
|
736
|
-
n(3,
|
|
738
|
+
n(3, b = !1);
|
|
737
739
|
};
|
|
738
|
-
return u.addEventListener("pointerenter",
|
|
739
|
-
u.removeEventListener("pointerenter",
|
|
740
|
+
return u.addEventListener("pointerenter", f), u.addEventListener("pointermove", A), u.addEventListener("pointerleave", w), () => {
|
|
741
|
+
u.removeEventListener("pointerenter", f), u.removeEventListener("pointermove", A), u.removeEventListener("pointerleave", w);
|
|
740
742
|
};
|
|
741
|
-
}), e.$$set = (
|
|
742
|
-
"container" in
|
|
743
|
+
}), e.$$set = (f) => {
|
|
744
|
+
"container" in f && n(6, u = f.container), "$$scope" in f && n(7, s = f.$$scope);
|
|
743
745
|
}, e.$$.update = () => {
|
|
744
746
|
e.$$.dirty & /*$hover*/
|
|
745
747
|
1 && n(4, o = r ? a.getAnnotation(r) : void 0);
|
|
746
|
-
}, [r, g, m,
|
|
748
|
+
}, [r, g, m, b, o, y, u, s, i];
|
|
747
749
|
}
|
|
748
750
|
class Yt extends Ae {
|
|
749
751
|
constructor(t) {
|
|
750
|
-
super(),
|
|
752
|
+
super(), xe(this, t, Ot, Pt, we, { container: 6 });
|
|
751
753
|
}
|
|
752
754
|
}
|
|
753
755
|
export {
|
|
754
756
|
Yt as MouseOverTooltip,
|
|
755
757
|
Rt as OpenSeadragonAnnotator,
|
|
756
758
|
Xt as OpenSeadragonPopup,
|
|
757
|
-
|
|
758
|
-
|
|
759
|
+
Vt as Origin,
|
|
760
|
+
Gt as ShapeType,
|
|
759
761
|
qt as UserSelectAction,
|
|
760
|
-
|
|
762
|
+
Jt as W3CImageFormat,
|
|
761
763
|
zt as createAnonymousGuest,
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
764
|
+
Wt as createBody,
|
|
765
|
+
Kt as createImageAnnotator,
|
|
766
|
+
$t as defaultColorProvider
|
|
765
767
|
};
|
|
766
768
|
//# sourceMappingURL=annotorious-svelte.es.js.map
|