@annotorious/plugin-segment-anything 0.1.8 → 0.1.10
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/assets/{sam2-worker-CtByxq2p.js → sam2-worker-Ds8tqCQ5.js} +2 -2
- package/dist/assets/{sam2-worker-CtByxq2p.js.map → sam2-worker-Ds8tqCQ5.js.map} +1 -1
- package/dist/{get-image-bounds-6QFs6_Gs.js → get-image-bounds-uVAZj3ys.js} +2 -2
- package/dist/{get-image-bounds-6QFs6_Gs.js.map → get-image-bounds-uVAZj3ys.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/openseadragon/index.js +429 -422
- package/dist/openseadragon/index.js.map +1 -1
- package/dist/sam2/sam2-worker-messages.d.ts +5 -1
- package/dist/types.d.ts +5 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as te, a as Fe, d as Be, q as Oe, F as Ae, f as He, s as Me, g as Ie, m as Le, W as ze, b as ke, v as Ne } from "../get-image-bounds-uVAZj3ys.js";
|
|
2
2
|
const Ue = (W) => {
|
|
3
|
-
const C =
|
|
4
|
-
|
|
5
|
-
const i = new
|
|
6
|
-
|
|
7
|
-
const r =
|
|
8
|
-
|
|
3
|
+
const C = te.imread(W), e = new te.Mat(), t = new te.MatVector(), n = new te.Mat();
|
|
4
|
+
te.cvtColor(C, e, te.COLOR_RGBA2GRAY);
|
|
5
|
+
const i = new te.Size(9, 9);
|
|
6
|
+
te.GaussianBlur(e, e, i, 0), te.threshold(e, e, 80, 255, te.THRESH_BINARY);
|
|
7
|
+
const r = te.Mat.ones(3, 3, te.CV_8U);
|
|
8
|
+
te.morphologyEx(e, e, te.MORPH_CLOSE, r), te.findContours(e, t, n, te.RETR_EXTERNAL, te.CHAIN_APPROX_SIMPLE);
|
|
9
9
|
let a = [];
|
|
10
10
|
if (t.size() > 0) {
|
|
11
11
|
let s = 0, o = 0;
|
|
@@ -13,8 +13,8 @@ const Ue = (W) => {
|
|
|
13
13
|
let v = t.get(f).rows;
|
|
14
14
|
v > s && (s = v, o = f);
|
|
15
15
|
}
|
|
16
|
-
const l = t.get(o), h = new
|
|
17
|
-
|
|
16
|
+
const l = t.get(o), h = new te.Mat(), d = 5e-3 * te.arcLength(l, !0);
|
|
17
|
+
te.approxPolyDP(l, h, d, !0);
|
|
18
18
|
for (let f = 0; f < h.rows; f++)
|
|
19
19
|
a.push([
|
|
20
20
|
h.data32S[f * 2],
|
|
@@ -38,7 +38,7 @@ let We = () => ({
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
var
|
|
41
|
+
var xe = { exports: {} }, Ge = xe.exports, be;
|
|
42
42
|
function Ve() {
|
|
43
43
|
return be || (be = 1, function(W) {
|
|
44
44
|
//! openseadragon 5.0.1
|
|
@@ -1366,14 +1366,14 @@ function Ve() {
|
|
|
1366
1366
|
*/
|
|
1367
1367
|
multiply(i) {
|
|
1368
1368
|
let r = this.values, a = i.values;
|
|
1369
|
-
var s = r[0 * 3 + 0], o = r[0 * 3 + 1], l = r[0 * 3 + 2], h = r[1 * 3 + 0], d = r[1 * 3 + 1], f = r[1 * 3 + 2], v = r[2 * 3 + 0], w = r[2 * 3 + 1], T = r[2 * 3 + 2], x = a[0 * 3 + 0], E = a[0 * 3 + 1], P = a[0 * 3 + 2], I = a[1 * 3 + 0],
|
|
1369
|
+
var s = r[0 * 3 + 0], o = r[0 * 3 + 1], l = r[0 * 3 + 2], h = r[1 * 3 + 0], d = r[1 * 3 + 1], f = r[1 * 3 + 2], v = r[2 * 3 + 0], w = r[2 * 3 + 1], T = r[2 * 3 + 2], x = a[0 * 3 + 0], E = a[0 * 3 + 1], P = a[0 * 3 + 2], I = a[1 * 3 + 0], O = a[1 * 3 + 1], z = a[1 * 3 + 2], V = a[2 * 3 + 0], j = a[2 * 3 + 1], Z = a[2 * 3 + 2];
|
|
1370
1370
|
return new t([
|
|
1371
1371
|
x * s + E * h + P * v,
|
|
1372
1372
|
x * o + E * d + P * w,
|
|
1373
1373
|
x * l + E * f + P * T,
|
|
1374
|
-
I * s +
|
|
1375
|
-
I * o +
|
|
1376
|
-
I * l +
|
|
1374
|
+
I * s + O * h + z * v,
|
|
1375
|
+
I * o + O * d + z * w,
|
|
1376
|
+
I * l + O * f + z * T,
|
|
1377
1377
|
V * s + j * h + Z * v,
|
|
1378
1378
|
V * o + j * d + Z * w,
|
|
1379
1379
|
V * l + j * f + Z * T
|
|
@@ -1584,10 +1584,10 @@ function Ve() {
|
|
|
1584
1584
|
I(g, y);
|
|
1585
1585
|
},
|
|
1586
1586
|
keydown: function(y) {
|
|
1587
|
-
|
|
1587
|
+
O(g, y);
|
|
1588
1588
|
},
|
|
1589
1589
|
keyup: function(y) {
|
|
1590
|
-
|
|
1590
|
+
z(g, y);
|
|
1591
1591
|
},
|
|
1592
1592
|
keypress: function(y) {
|
|
1593
1593
|
V(g, y);
|
|
@@ -1599,58 +1599,58 @@ function Ve() {
|
|
|
1599
1599
|
Z(g, y);
|
|
1600
1600
|
},
|
|
1601
1601
|
contextmenu: function(y) {
|
|
1602
|
-
|
|
1602
|
+
$(g, y);
|
|
1603
1603
|
},
|
|
1604
1604
|
wheel: function(y) {
|
|
1605
|
-
|
|
1605
|
+
X(g, y);
|
|
1606
1606
|
},
|
|
1607
1607
|
mousewheel: function(y) {
|
|
1608
|
-
|
|
1608
|
+
B(g, y);
|
|
1609
1609
|
},
|
|
1610
1610
|
DOMMouseScroll: function(y) {
|
|
1611
|
-
|
|
1611
|
+
B(g, y);
|
|
1612
1612
|
},
|
|
1613
1613
|
MozMousePixelScroll: function(y) {
|
|
1614
|
-
|
|
1614
|
+
B(g, y);
|
|
1615
1615
|
},
|
|
1616
1616
|
losecapture: function(y) {
|
|
1617
|
-
|
|
1617
|
+
k(g, y);
|
|
1618
1618
|
},
|
|
1619
1619
|
mouseenter: function(y) {
|
|
1620
1620
|
G(g, y);
|
|
1621
1621
|
},
|
|
1622
1622
|
mouseleave: function(y) {
|
|
1623
|
-
|
|
1623
|
+
fe(g, y);
|
|
1624
1624
|
},
|
|
1625
1625
|
mouseover: function(y) {
|
|
1626
|
-
|
|
1626
|
+
ge(g, y);
|
|
1627
1627
|
},
|
|
1628
1628
|
mouseout: function(y) {
|
|
1629
|
-
|
|
1629
|
+
me(g, y);
|
|
1630
1630
|
},
|
|
1631
1631
|
mousedown: function(y) {
|
|
1632
|
-
|
|
1632
|
+
ue(g, y);
|
|
1633
1633
|
},
|
|
1634
1634
|
mouseup: function(y) {
|
|
1635
|
-
|
|
1635
|
+
ve(g, y);
|
|
1636
1636
|
},
|
|
1637
1637
|
mousemove: function(y) {
|
|
1638
|
-
|
|
1638
|
+
we(g, y);
|
|
1639
1639
|
},
|
|
1640
1640
|
touchstart: function(y) {
|
|
1641
|
-
|
|
1641
|
+
q(g, y);
|
|
1642
1642
|
},
|
|
1643
1643
|
touchend: function(y) {
|
|
1644
|
-
|
|
1644
|
+
J(g, y);
|
|
1645
1645
|
},
|
|
1646
1646
|
touchmove: function(y) {
|
|
1647
|
-
|
|
1647
|
+
ie(g, y);
|
|
1648
1648
|
},
|
|
1649
1649
|
touchcancel: function(y) {
|
|
1650
|
-
|
|
1650
|
+
ne(g, y);
|
|
1651
1651
|
},
|
|
1652
1652
|
gesturestart: function(y) {
|
|
1653
|
-
|
|
1653
|
+
se(g, y);
|
|
1654
1654
|
},
|
|
1655
1655
|
// Safari/Safari iOS
|
|
1656
1656
|
gesturechange: function(y) {
|
|
@@ -1658,31 +1658,31 @@ function Ve() {
|
|
|
1658
1658
|
},
|
|
1659
1659
|
// Safari/Safari iOS
|
|
1660
1660
|
gotpointercapture: function(y) {
|
|
1661
|
-
|
|
1661
|
+
le(g, y);
|
|
1662
1662
|
},
|
|
1663
1663
|
lostpointercapture: function(y) {
|
|
1664
|
-
|
|
1664
|
+
he(g, y);
|
|
1665
1665
|
},
|
|
1666
1666
|
pointerenter: function(y) {
|
|
1667
1667
|
G(g, y);
|
|
1668
1668
|
},
|
|
1669
1669
|
pointerleave: function(y) {
|
|
1670
|
-
|
|
1670
|
+
fe(g, y);
|
|
1671
1671
|
},
|
|
1672
1672
|
pointerover: function(y) {
|
|
1673
|
-
|
|
1673
|
+
ge(g, y);
|
|
1674
1674
|
},
|
|
1675
1675
|
pointerout: function(y) {
|
|
1676
|
-
|
|
1676
|
+
me(g, y);
|
|
1677
1677
|
},
|
|
1678
1678
|
pointerdown: function(y) {
|
|
1679
|
-
|
|
1679
|
+
ue(g, y);
|
|
1680
1680
|
},
|
|
1681
1681
|
pointerup: function(y) {
|
|
1682
|
-
|
|
1682
|
+
ve(g, y);
|
|
1683
1683
|
},
|
|
1684
1684
|
pointermove: function(y) {
|
|
1685
|
-
|
|
1685
|
+
we(g, y);
|
|
1686
1686
|
},
|
|
1687
1687
|
pointercancel: function(y) {
|
|
1688
1688
|
Se(g, y);
|
|
@@ -2372,32 +2372,32 @@ function Ve() {
|
|
|
2372
2372
|
}
|
|
2373
2373
|
}
|
|
2374
2374
|
e.MouseTracker.gesturePointVelocityTracker = /* @__PURE__ */ function() {
|
|
2375
|
-
var p = [], c = 0, g = 0, y = function(
|
|
2376
|
-
return
|
|
2375
|
+
var p = [], c = 0, g = 0, y = function(K, M) {
|
|
2376
|
+
return K.hash.toString() + M.type + M.id.toString();
|
|
2377
2377
|
}, S = function() {
|
|
2378
|
-
var
|
|
2379
|
-
for (Pe =
|
|
2380
|
-
|
|
2381
|
-
}, D = function(
|
|
2382
|
-
var
|
|
2378
|
+
var K, M = p.length, oe, re, de = e.now(), Pe, Re, Ce;
|
|
2379
|
+
for (Pe = de - g, g = de, K = 0; K < M; K++)
|
|
2380
|
+
oe = p[K], re = oe.gPoint, re.direction = Math.atan2(re.currentPos.y - oe.lastPos.y, re.currentPos.x - oe.lastPos.x), Re = oe.lastPos.distanceTo(re.currentPos), oe.lastPos = re.currentPos, Ce = 1e3 * Re / (Pe + 1), re.speed = 0.75 * Ce + 0.25 * re.speed;
|
|
2381
|
+
}, D = function(K, M) {
|
|
2382
|
+
var oe = y(K, M);
|
|
2383
2383
|
p.push(
|
|
2384
2384
|
{
|
|
2385
|
-
guid:
|
|
2386
|
-
gPoint:
|
|
2387
|
-
lastPos:
|
|
2385
|
+
guid: oe,
|
|
2386
|
+
gPoint: M,
|
|
2387
|
+
lastPos: M.currentPos
|
|
2388
2388
|
}
|
|
2389
2389
|
), p.length === 1 && (g = e.now(), c = window.setInterval(S, 50));
|
|
2390
|
-
},
|
|
2391
|
-
var
|
|
2392
|
-
for (re = 0; re <
|
|
2393
|
-
if (p[re].guid ===
|
|
2394
|
-
p.splice(re, 1),
|
|
2390
|
+
}, H = function(K, M) {
|
|
2391
|
+
var oe = y(K, M), re, de = p.length;
|
|
2392
|
+
for (re = 0; re < de; re++)
|
|
2393
|
+
if (p[re].guid === oe) {
|
|
2394
|
+
p.splice(re, 1), de--, de === 0 && window.clearInterval(c);
|
|
2395
2395
|
break;
|
|
2396
2396
|
}
|
|
2397
2397
|
};
|
|
2398
2398
|
return {
|
|
2399
2399
|
addPoint: D,
|
|
2400
|
-
removePoint:
|
|
2400
|
+
removePoint: H
|
|
2401
2401
|
};
|
|
2402
2402
|
}(), e.MouseTracker.captureElement = document, e.MouseTracker.wheelEventName = "onwheel" in document.createElement("div") ? "wheel" : (
|
|
2403
2403
|
// Modern browsers support 'wheel'
|
|
@@ -2499,15 +2499,15 @@ function Ve() {
|
|
|
2499
2499
|
}
|
|
2500
2500
|
};
|
|
2501
2501
|
function r(p) {
|
|
2502
|
-
var c = t[p.hash], g, y, S, D,
|
|
2503
|
-
for (g = 0; g <
|
|
2502
|
+
var c = t[p.hash], g, y, S, D, H, K = c.activePointersLists.length;
|
|
2503
|
+
for (g = 0; g < K; g++)
|
|
2504
2504
|
if (S = c.activePointersLists[g], S.getLength() > 0) {
|
|
2505
|
-
for (
|
|
2506
|
-
|
|
2507
|
-
for (y = 0; y <
|
|
2508
|
-
|
|
2505
|
+
for (H = [], D = S.asArray(), y = 0; y < D.length; y++)
|
|
2506
|
+
H.push(D[y]);
|
|
2507
|
+
for (y = 0; y < H.length; y++)
|
|
2508
|
+
ce(p, S, H[y]);
|
|
2509
2509
|
}
|
|
2510
|
-
for (g = 0; g <
|
|
2510
|
+
for (g = 0; g < K; g++)
|
|
2511
2511
|
c.activePointersLists.pop();
|
|
2512
2512
|
c.sentDragEvent = !1;
|
|
2513
2513
|
}
|
|
@@ -2664,7 +2664,7 @@ function Ve() {
|
|
|
2664
2664
|
};
|
|
2665
2665
|
m(p, g), g.preventDefault && !g.defaultPrevented && e.cancelEvent(c), g.stopPropagation && e.stopEvent(c);
|
|
2666
2666
|
}
|
|
2667
|
-
function
|
|
2667
|
+
function O(p, c) {
|
|
2668
2668
|
var g = null, y = {
|
|
2669
2669
|
originalEvent: c,
|
|
2670
2670
|
eventType: "keydown",
|
|
@@ -2683,7 +2683,7 @@ function Ve() {
|
|
|
2683
2683
|
userData: p.userData
|
|
2684
2684
|
}, p.keyDownHandler(g)), (g && g.preventDefault || y.preventDefault && !y.defaultPrevented) && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
|
|
2685
2685
|
}
|
|
2686
|
-
function
|
|
2686
|
+
function z(p, c) {
|
|
2687
2687
|
var g = null, y = {
|
|
2688
2688
|
originalEvent: c,
|
|
2689
2689
|
eventType: "keyup",
|
|
@@ -2751,7 +2751,7 @@ function Ve() {
|
|
|
2751
2751
|
}
|
|
2752
2752
|
);
|
|
2753
2753
|
}
|
|
2754
|
-
function
|
|
2754
|
+
function $(p, c) {
|
|
2755
2755
|
var g = null, y = {
|
|
2756
2756
|
originalEvent: c,
|
|
2757
2757
|
eventType: "contextmenu",
|
|
@@ -2766,10 +2766,10 @@ function Ve() {
|
|
|
2766
2766
|
userData: p.userData
|
|
2767
2767
|
}, p.contextMenuHandler(g)), (g && g.preventDefault || y.preventDefault && !y.defaultPrevented) && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
|
|
2768
2768
|
}
|
|
2769
|
-
function
|
|
2770
|
-
|
|
2769
|
+
function X(p, c) {
|
|
2770
|
+
L(p, c, c);
|
|
2771
2771
|
}
|
|
2772
|
-
function
|
|
2772
|
+
function B(p, c) {
|
|
2773
2773
|
var g = {
|
|
2774
2774
|
target: c.target || c.srcElement,
|
|
2775
2775
|
type: "wheel",
|
|
@@ -2783,9 +2783,9 @@ function Ve() {
|
|
|
2783
2783
|
deltaX: 0,
|
|
2784
2784
|
deltaZ: 0
|
|
2785
2785
|
};
|
|
2786
|
-
e.MouseTracker.wheelEventName === "mousewheel" ? g.deltaY = -c.wheelDelta / e.DEFAULT_SETTINGS.pixelsPerWheelLine : g.deltaY = c.detail,
|
|
2786
|
+
e.MouseTracker.wheelEventName === "mousewheel" ? g.deltaY = -c.wheelDelta / e.DEFAULT_SETTINGS.pixelsPerWheelLine : g.deltaY = c.detail, L(p, g, c);
|
|
2787
2787
|
}
|
|
2788
|
-
function
|
|
2788
|
+
function L(p, c, g) {
|
|
2789
2789
|
var y = 0, S, D = null;
|
|
2790
2790
|
y = c.deltaY ? c.deltaY < 0 ? 1 : -1 : 0, S = {
|
|
2791
2791
|
originalEvent: c,
|
|
@@ -2804,7 +2804,7 @@ function Ve() {
|
|
|
2804
2804
|
userData: p.userData
|
|
2805
2805
|
}, p.scrollHandler(D)), S.stopPropagation && e.stopEvent(g), (D && D.preventDefault || S.preventDefault && !S.defaultPrevented) && e.cancelEvent(g);
|
|
2806
2806
|
}
|
|
2807
|
-
function
|
|
2807
|
+
function k(p, c) {
|
|
2808
2808
|
var g = {
|
|
2809
2809
|
id: e.MouseTracker.mousePointerId,
|
|
2810
2810
|
type: "mouse"
|
|
@@ -2816,63 +2816,63 @@ function Ve() {
|
|
|
2816
2816
|
};
|
|
2817
2817
|
m(p, y), c.target === p.element && _(p, g, !1), y.stopPropagation && e.stopEvent(c);
|
|
2818
2818
|
}
|
|
2819
|
-
function
|
|
2820
|
-
var g, y, S = c.changedTouches.length, D,
|
|
2821
|
-
g = e.now(),
|
|
2822
|
-
var
|
|
2819
|
+
function q(p, c) {
|
|
2820
|
+
var g, y, S = c.changedTouches.length, D, H = p.getActivePointersListByType("touch");
|
|
2821
|
+
g = e.now(), H.getLength() > c.touches.length - S && e.console.warn("Tracked touch contact count doesn't match event.touches.length");
|
|
2822
|
+
var K = {
|
|
2823
2823
|
originalEvent: c,
|
|
2824
2824
|
eventType: "pointerdown",
|
|
2825
2825
|
pointerType: "touch",
|
|
2826
2826
|
isEmulated: !1
|
|
2827
2827
|
};
|
|
2828
|
-
for (m(p,
|
|
2828
|
+
for (m(p, K), y = 0; y < S; y++)
|
|
2829
2829
|
D = {
|
|
2830
2830
|
id: c.changedTouches[y].identifier,
|
|
2831
2831
|
type: "touch",
|
|
2832
2832
|
// Simulate isPrimary
|
|
2833
|
-
isPrimary:
|
|
2833
|
+
isPrimary: H.getLength() === 0,
|
|
2834
2834
|
currentPos: w(c.changedTouches[y]),
|
|
2835
2835
|
currentTime: g
|
|
2836
|
-
}, b(p,
|
|
2837
|
-
|
|
2836
|
+
}, b(p, K, D), N(p, K, D, 0), _(p, D, !0);
|
|
2837
|
+
K.preventDefault && !K.defaultPrevented && e.cancelEvent(c), K.stopPropagation && e.stopEvent(c);
|
|
2838
2838
|
}
|
|
2839
|
-
function
|
|
2839
|
+
function J(p, c) {
|
|
2840
2840
|
var g, y, S = c.changedTouches.length, D;
|
|
2841
2841
|
g = e.now();
|
|
2842
|
-
var
|
|
2842
|
+
var H = {
|
|
2843
2843
|
originalEvent: c,
|
|
2844
2844
|
eventType: "pointerup",
|
|
2845
2845
|
pointerType: "touch",
|
|
2846
2846
|
isEmulated: !1
|
|
2847
2847
|
};
|
|
2848
|
-
for (m(p,
|
|
2848
|
+
for (m(p, H), y = 0; y < S; y++)
|
|
2849
2849
|
D = {
|
|
2850
2850
|
id: c.changedTouches[y].identifier,
|
|
2851
2851
|
type: "touch",
|
|
2852
2852
|
currentPos: w(c.changedTouches[y]),
|
|
2853
2853
|
currentTime: g
|
|
2854
|
-
},
|
|
2855
|
-
|
|
2854
|
+
}, Y(p, H, D, 0), _(p, D, !1), F(p, H, D);
|
|
2855
|
+
H.preventDefault && !H.defaultPrevented && e.cancelEvent(c), H.stopPropagation && e.stopEvent(c);
|
|
2856
2856
|
}
|
|
2857
|
-
function
|
|
2857
|
+
function ie(p, c) {
|
|
2858
2858
|
var g, y, S = c.changedTouches.length, D;
|
|
2859
2859
|
g = e.now();
|
|
2860
|
-
var
|
|
2860
|
+
var H = {
|
|
2861
2861
|
originalEvent: c,
|
|
2862
2862
|
eventType: "pointermove",
|
|
2863
2863
|
pointerType: "touch",
|
|
2864
2864
|
isEmulated: !1
|
|
2865
2865
|
};
|
|
2866
|
-
for (m(p,
|
|
2866
|
+
for (m(p, H), y = 0; y < S; y++)
|
|
2867
2867
|
D = {
|
|
2868
2868
|
id: c.changedTouches[y].identifier,
|
|
2869
2869
|
type: "touch",
|
|
2870
2870
|
currentPos: w(c.changedTouches[y]),
|
|
2871
2871
|
currentTime: g
|
|
2872
|
-
}, Q(p,
|
|
2873
|
-
|
|
2872
|
+
}, Q(p, H, D);
|
|
2873
|
+
H.preventDefault && !H.defaultPrevented && e.cancelEvent(c), H.stopPropagation && e.stopEvent(c);
|
|
2874
2874
|
}
|
|
2875
|
-
function
|
|
2875
|
+
function ne(p, c) {
|
|
2876
2876
|
var g = c.changedTouches.length, y, S, D = {
|
|
2877
2877
|
originalEvent: c,
|
|
2878
2878
|
eventType: "pointercancel",
|
|
@@ -2886,13 +2886,13 @@ function Ve() {
|
|
|
2886
2886
|
}, U(p, D, S);
|
|
2887
2887
|
D.stopPropagation && e.stopEvent(c);
|
|
2888
2888
|
}
|
|
2889
|
-
function
|
|
2889
|
+
function se(p, c) {
|
|
2890
2890
|
return e.eventIsCanceled(c) || c.preventDefault(), !1;
|
|
2891
2891
|
}
|
|
2892
2892
|
function ae(p, c) {
|
|
2893
2893
|
return e.eventIsCanceled(c) || c.preventDefault(), !1;
|
|
2894
2894
|
}
|
|
2895
|
-
function
|
|
2895
|
+
function le(p, c) {
|
|
2896
2896
|
var g = {
|
|
2897
2897
|
originalEvent: c,
|
|
2898
2898
|
eventType: "gotpointercapture",
|
|
@@ -2904,7 +2904,7 @@ function Ve() {
|
|
|
2904
2904
|
type: f(c)
|
|
2905
2905
|
}, !0), g.stopPropagation && e.stopEvent(c);
|
|
2906
2906
|
}
|
|
2907
|
-
function
|
|
2907
|
+
function he(p, c) {
|
|
2908
2908
|
var g = {
|
|
2909
2909
|
originalEvent: c,
|
|
2910
2910
|
eventType: "lostpointercapture",
|
|
@@ -2931,7 +2931,7 @@ function Ve() {
|
|
|
2931
2931
|
};
|
|
2932
2932
|
m(p, y), b(p, y, g);
|
|
2933
2933
|
}
|
|
2934
|
-
function
|
|
2934
|
+
function fe(p, c) {
|
|
2935
2935
|
var g = {
|
|
2936
2936
|
id: d(c),
|
|
2937
2937
|
type: f(c),
|
|
@@ -2946,7 +2946,7 @@ function Ve() {
|
|
|
2946
2946
|
};
|
|
2947
2947
|
m(p, y), F(p, y, g);
|
|
2948
2948
|
}
|
|
2949
|
-
function
|
|
2949
|
+
function ge(p, c) {
|
|
2950
2950
|
var g = {
|
|
2951
2951
|
id: d(c),
|
|
2952
2952
|
type: f(c),
|
|
@@ -2959,9 +2959,9 @@ function Ve() {
|
|
|
2959
2959
|
pointerType: g.type,
|
|
2960
2960
|
isEmulated: !1
|
|
2961
2961
|
};
|
|
2962
|
-
m(p, y),
|
|
2962
|
+
m(p, y), A(p, y, g), y.preventDefault && !y.defaultPrevented && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
|
|
2963
2963
|
}
|
|
2964
|
-
function
|
|
2964
|
+
function me(p, c) {
|
|
2965
2965
|
var g = {
|
|
2966
2966
|
id: d(c),
|
|
2967
2967
|
type: f(c),
|
|
@@ -2976,7 +2976,7 @@ function Ve() {
|
|
|
2976
2976
|
};
|
|
2977
2977
|
m(p, y), R(p, y, g), y.preventDefault && !y.defaultPrevented && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c);
|
|
2978
2978
|
}
|
|
2979
|
-
function
|
|
2979
|
+
function ue(p, c) {
|
|
2980
2980
|
var g = {
|
|
2981
2981
|
id: d(c),
|
|
2982
2982
|
type: f(c),
|
|
@@ -2991,14 +2991,14 @@ function Ve() {
|
|
|
2991
2991
|
};
|
|
2992
2992
|
m(p, S), N(p, S, g, c.button), S.preventDefault && !S.defaultPrevented && e.cancelEvent(c), S.stopPropagation && e.stopEvent(c), S.shouldCapture && (y ? _(p, g, !0) : l(p, g));
|
|
2993
2993
|
}
|
|
2994
|
-
function
|
|
2995
|
-
|
|
2994
|
+
function ve(p, c) {
|
|
2995
|
+
ye(p, c);
|
|
2996
2996
|
}
|
|
2997
2997
|
function _e(p, c) {
|
|
2998
2998
|
var g = p.getActivePointersListByType(f(c));
|
|
2999
|
-
g.getById(c.pointerId) &&
|
|
2999
|
+
g.getById(c.pointerId) && ye(p, c), e.stopEvent(c);
|
|
3000
3000
|
}
|
|
3001
|
-
function
|
|
3001
|
+
function ye(p, c) {
|
|
3002
3002
|
var g;
|
|
3003
3003
|
g = {
|
|
3004
3004
|
id: d(c),
|
|
@@ -3013,16 +3013,16 @@ function Ve() {
|
|
|
3013
3013
|
pointerType: g.type,
|
|
3014
3014
|
isEmulated: !1
|
|
3015
3015
|
};
|
|
3016
|
-
m(p, y),
|
|
3016
|
+
m(p, y), Y(p, y, g, c.button), y.preventDefault && !y.defaultPrevented && e.cancelEvent(c), y.stopPropagation && e.stopEvent(c), y.shouldReleaseCapture && (c.target === p.element ? h(p, g) : _(p, g, !1));
|
|
3017
3017
|
}
|
|
3018
|
-
function
|
|
3019
|
-
|
|
3018
|
+
function we(p, c) {
|
|
3019
|
+
Te(p, c);
|
|
3020
3020
|
}
|
|
3021
3021
|
function Ee(p, c) {
|
|
3022
3022
|
var g = p.getActivePointersListByType(f(c));
|
|
3023
|
-
g.getById(c.pointerId) &&
|
|
3023
|
+
g.getById(c.pointerId) && Te(p, c), e.stopEvent(c);
|
|
3024
3024
|
}
|
|
3025
|
-
function
|
|
3025
|
+
function Te(p, c) {
|
|
3026
3026
|
var g = {
|
|
3027
3027
|
id: d(c),
|
|
3028
3028
|
type: f(c),
|
|
@@ -3049,10 +3049,10 @@ function Ve() {
|
|
|
3049
3049
|
};
|
|
3050
3050
|
m(p, y), U(p, y, g), y.stopPropagation && e.stopEvent(c);
|
|
3051
3051
|
}
|
|
3052
|
-
function
|
|
3052
|
+
function pe(p, c) {
|
|
3053
3053
|
return c.speed = 0, c.direction = 0, c.contactPos = c.currentPos, c.contactTime = c.currentTime, c.lastPos = c.currentPos, c.lastTime = c.currentTime, p.add(c);
|
|
3054
3054
|
}
|
|
3055
|
-
function
|
|
3055
|
+
function ce(p, c, g) {
|
|
3056
3056
|
var y, S = c.getById(g.id);
|
|
3057
3057
|
return S ? (S.captured && (e.console.warn("stopTrackingPointer() called on captured pointer"), h(p, S)), c.removeContact(), y = c.removeById(g.id)) : y = c.getLength(), y;
|
|
3058
3058
|
}
|
|
@@ -3107,7 +3107,7 @@ function Ve() {
|
|
|
3107
3107
|
}
|
|
3108
3108
|
function b(p, c, g) {
|
|
3109
3109
|
var y = p.getActivePointersListByType(g.type), S;
|
|
3110
|
-
S = y.getById(g.id), S ? (S.insideElement = !0, S.lastPos = S.currentPos, S.lastTime = S.currentTime, S.currentPos = g.currentPos, S.currentTime = g.currentTime, g = S) : (g.captured = !1, g.insideElementPressed = !1, g.insideElement = !0,
|
|
3110
|
+
S = y.getById(g.id), S ? (S.insideElement = !0, S.lastPos = S.currentPos, S.lastTime = S.currentTime, S.currentPos = g.currentPos, S.currentTime = g.currentTime, g = S) : (g.captured = !1, g.insideElementPressed = !1, g.insideElement = !0, pe(y, g)), p.enterHandler && p.enterHandler(
|
|
3111
3111
|
{
|
|
3112
3112
|
eventSource: p,
|
|
3113
3113
|
pointerType: g.type,
|
|
@@ -3124,7 +3124,7 @@ function Ve() {
|
|
|
3124
3124
|
}
|
|
3125
3125
|
function F(p, c, g) {
|
|
3126
3126
|
var y = p.getActivePointersListByType(g.type), S, D;
|
|
3127
|
-
S = y.getById(g.id), S ? (S.captured ? (S.insideElement = !1, S.lastPos = S.currentPos, S.lastTime = S.currentTime, S.currentPos = g.currentPos, S.currentTime = g.currentTime) :
|
|
3127
|
+
S = y.getById(g.id), S ? (S.captured ? (S.insideElement = !1, S.lastPos = S.currentPos, S.lastTime = S.currentTime, S.currentPos = g.currentPos, S.currentTime = g.currentTime) : ce(p, y, S), g = S) : (g.captured = !1, g.insideElementPressed = !1), (p.leaveHandler || p.exitHandler) && (D = {
|
|
3128
3128
|
eventSource: p,
|
|
3129
3129
|
pointerType: g.type,
|
|
3130
3130
|
// GitHub PR: https://github.com/openseadragon/openseadragon/pull/1754 (gPoint.currentPos && )
|
|
@@ -3138,7 +3138,7 @@ function Ve() {
|
|
|
3138
3138
|
userData: p.userData
|
|
3139
3139
|
}, p.leaveHandler && p.leaveHandler(D), p.exitHandler && p.exitHandler(D));
|
|
3140
3140
|
}
|
|
3141
|
-
function
|
|
3141
|
+
function A(p, c, g) {
|
|
3142
3142
|
var y, S;
|
|
3143
3143
|
y = p.getActivePointersListByType(g.type), S = y.getById(g.id), S ? g = S : (g.captured = !1, g.insideElementPressed = !1), p.overHandler && p.overHandler(
|
|
3144
3144
|
{
|
|
@@ -3171,7 +3171,7 @@ function Ve() {
|
|
|
3171
3171
|
});
|
|
3172
3172
|
}
|
|
3173
3173
|
function N(p, c, g, y) {
|
|
3174
|
-
var S = t[p.hash], D = p.getActivePointersListByType(g.type),
|
|
3174
|
+
var S = t[p.hash], D = p.getActivePointersListByType(g.type), H;
|
|
3175
3175
|
if (typeof c.originalEvent.buttons < "u" ? D.buttons = c.originalEvent.buttons : y === 0 ? D.buttons |= 1 : y === 1 ? D.buttons |= 4 : y === 2 ? D.buttons |= 2 : y === 3 ? D.buttons |= 8 : y === 4 ? D.buttons |= 16 : y === 5 && (D.buttons |= 32), y !== 0) {
|
|
3176
3176
|
c.shouldCapture = !1, c.shouldReleaseCapture = !1, p.nonPrimaryPressHandler && !c.preventGesture && !c.defaultPrevented && (c.preventDefault = !0, p.nonPrimaryPressHandler(
|
|
3177
3177
|
{
|
|
@@ -3187,7 +3187,7 @@ function Ve() {
|
|
|
3187
3187
|
));
|
|
3188
3188
|
return;
|
|
3189
3189
|
}
|
|
3190
|
-
|
|
3190
|
+
H = D.getById(g.id), H ? (H.insideElementPressed = !0, H.insideElement = !0, H.originalTarget = c.originalEvent.target, H.contactPos = g.currentPos, H.contactTime = g.currentTime, H.lastPos = H.currentPos, H.lastTime = H.currentTime, H.currentPos = g.currentPos, H.currentTime = g.currentTime, g = H) : (g.captured = !1, g.insideElementPressed = !0, g.insideElement = !0, g.originalTarget = c.originalEvent.target, pe(D, g)), D.addContact(), !c.preventGesture && !c.defaultPrevented ? (c.shouldCapture = !0, c.shouldReleaseCapture = !1, c.preventDefault = !0, (p.dragHandler || p.dragEndHandler || p.pinchHandler) && e.MouseTracker.gesturePointVelocityTracker.addPoint(p, g), D.contacts === 1 ? p.pressHandler && !c.preventGesture && p.pressHandler(
|
|
3191
3191
|
{
|
|
3192
3192
|
eventSource: p,
|
|
3193
3193
|
pointerType: g.type,
|
|
@@ -3199,8 +3199,8 @@ function Ve() {
|
|
|
3199
3199
|
}
|
|
3200
3200
|
) : D.contacts === 2 && p.pinchHandler && g.type === "touch" && (S.pinchGPoints = D.asArray(), S.lastPinchDist = S.currentPinchDist = S.pinchGPoints[0].currentPos.distanceTo(S.pinchGPoints[1].currentPos), S.lastPinchCenter = S.currentPinchCenter = E(S.pinchGPoints[0].currentPos, S.pinchGPoints[1].currentPos))) : (c.shouldCapture = !1, c.shouldReleaseCapture = !1);
|
|
3201
3201
|
}
|
|
3202
|
-
function
|
|
3203
|
-
var S = t[p.hash], D = p.getActivePointersListByType(g.type),
|
|
3202
|
+
function Y(p, c, g, y) {
|
|
3203
|
+
var S = t[p.hash], D = p.getActivePointersListByType(g.type), H, K, M, oe = !1, re;
|
|
3204
3204
|
if (typeof c.originalEvent.buttons < "u" ? D.buttons = c.originalEvent.buttons : y === 0 ? D.buttons ^= -2 : y === 1 ? D.buttons ^= -5 : y === 2 ? D.buttons ^= -3 : y === 3 ? D.buttons ^= -9 : y === 4 ? D.buttons ^= -17 : y === 5 && (D.buttons ^= -33), c.shouldCapture = !1, y !== 0) {
|
|
3205
3205
|
c.shouldReleaseCapture = !1, p.nonPrimaryReleaseHandler && !c.preventGesture && !c.defaultPrevented && (c.preventDefault = !0, p.nonPrimaryReleaseHandler(
|
|
3206
3206
|
{
|
|
@@ -3216,70 +3216,70 @@ function Ve() {
|
|
|
3216
3216
|
));
|
|
3217
3217
|
return;
|
|
3218
3218
|
}
|
|
3219
|
-
|
|
3219
|
+
M = D.getById(g.id), M ? (D.removeContact(), M.captured && (oe = !0), M.lastPos = M.currentPos, M.lastTime = M.currentTime, M.currentPos = g.currentPos, M.currentTime = g.currentTime, M.insideElement || ce(p, D, M), H = M.currentPos, K = M.currentTime) : (g.captured = !1, g.insideElementPressed = !1, g.insideElement = !0, pe(D, g), M = g), !c.preventGesture && !c.defaultPrevented && (oe ? (c.shouldReleaseCapture = !0, c.preventDefault = !0, (p.dragHandler || p.dragEndHandler || p.pinchHandler) && e.MouseTracker.gesturePointVelocityTracker.removePoint(p, M), D.contacts === 0 ? (p.releaseHandler && H && p.releaseHandler(
|
|
3220
3220
|
{
|
|
3221
3221
|
eventSource: p,
|
|
3222
|
-
pointerType:
|
|
3223
|
-
position: x(
|
|
3222
|
+
pointerType: M.type,
|
|
3223
|
+
position: x(H, p.element),
|
|
3224
3224
|
buttons: D.buttons,
|
|
3225
|
-
insideElementPressed:
|
|
3226
|
-
insideElementReleased:
|
|
3227
|
-
isTouchEvent:
|
|
3225
|
+
insideElementPressed: M.insideElementPressed,
|
|
3226
|
+
insideElementReleased: M.insideElement,
|
|
3227
|
+
isTouchEvent: M.type === "touch",
|
|
3228
3228
|
originalEvent: c.originalEvent,
|
|
3229
3229
|
userData: p.userData
|
|
3230
3230
|
}
|
|
3231
3231
|
), p.dragEndHandler && S.sentDragEvent && p.dragEndHandler(
|
|
3232
3232
|
{
|
|
3233
3233
|
eventSource: p,
|
|
3234
|
-
pointerType:
|
|
3235
|
-
position: x(
|
|
3236
|
-
speed:
|
|
3237
|
-
direction:
|
|
3234
|
+
pointerType: M.type,
|
|
3235
|
+
position: x(M.currentPos, p.element),
|
|
3236
|
+
speed: M.speed,
|
|
3237
|
+
direction: M.direction,
|
|
3238
3238
|
shift: c.originalEvent.shiftKey,
|
|
3239
|
-
isTouchEvent:
|
|
3239
|
+
isTouchEvent: M.type === "touch",
|
|
3240
3240
|
originalEvent: c.originalEvent,
|
|
3241
3241
|
userData: p.userData
|
|
3242
3242
|
}
|
|
3243
|
-
), S.sentDragEvent = !1, (p.clickHandler || p.dblClickHandler) &&
|
|
3243
|
+
), S.sentDragEvent = !1, (p.clickHandler || p.dblClickHandler) && M.insideElement && (re = K - M.contactTime <= p.clickTimeThreshold && M.contactPos.distanceTo(H) <= p.clickDistThreshold, p.clickHandler && p.clickHandler(
|
|
3244
3244
|
{
|
|
3245
3245
|
eventSource: p,
|
|
3246
|
-
pointerType:
|
|
3247
|
-
position: x(
|
|
3246
|
+
pointerType: M.type,
|
|
3247
|
+
position: x(M.currentPos, p.element),
|
|
3248
3248
|
quick: re,
|
|
3249
3249
|
shift: c.originalEvent.shiftKey,
|
|
3250
|
-
isTouchEvent:
|
|
3250
|
+
isTouchEvent: M.type === "touch",
|
|
3251
3251
|
originalEvent: c.originalEvent,
|
|
3252
|
-
originalTarget:
|
|
3252
|
+
originalTarget: M.originalTarget,
|
|
3253
3253
|
userData: p.userData
|
|
3254
3254
|
}
|
|
3255
|
-
), p.dblClickHandler && re && (D.clicks++, D.clicks === 1 ? (S.lastClickPos =
|
|
3255
|
+
), p.dblClickHandler && re && (D.clicks++, D.clicks === 1 ? (S.lastClickPos = H, S.dblClickTimeOut = setTimeout(function() {
|
|
3256
3256
|
D.clicks = 0;
|
|
3257
|
-
}, p.dblClickTimeThreshold)) : D.clicks === 2 && (clearTimeout(S.dblClickTimeOut), D.clicks = 0, S.lastClickPos.distanceTo(
|
|
3257
|
+
}, p.dblClickTimeThreshold)) : D.clicks === 2 && (clearTimeout(S.dblClickTimeOut), D.clicks = 0, S.lastClickPos.distanceTo(H) <= p.dblClickDistThreshold && p.dblClickHandler(
|
|
3258
3258
|
{
|
|
3259
3259
|
eventSource: p,
|
|
3260
|
-
pointerType:
|
|
3261
|
-
position: x(
|
|
3260
|
+
pointerType: M.type,
|
|
3261
|
+
position: x(M.currentPos, p.element),
|
|
3262
3262
|
shift: c.originalEvent.shiftKey,
|
|
3263
|
-
isTouchEvent:
|
|
3263
|
+
isTouchEvent: M.type === "touch",
|
|
3264
3264
|
originalEvent: c.originalEvent,
|
|
3265
3265
|
userData: p.userData
|
|
3266
3266
|
}
|
|
3267
|
-
), S.lastClickPos = null)))) : D.contacts === 2 && p.pinchHandler &&
|
|
3267
|
+
), S.lastClickPos = null)))) : D.contacts === 2 && p.pinchHandler && M.type === "touch" && (S.pinchGPoints = D.asArray(), S.lastPinchDist = S.currentPinchDist = S.pinchGPoints[0].currentPos.distanceTo(S.pinchGPoints[1].currentPos), S.lastPinchCenter = S.currentPinchCenter = E(S.pinchGPoints[0].currentPos, S.pinchGPoints[1].currentPos))) : (c.shouldReleaseCapture = !1, p.releaseHandler && H && (p.releaseHandler(
|
|
3268
3268
|
{
|
|
3269
3269
|
eventSource: p,
|
|
3270
|
-
pointerType:
|
|
3271
|
-
position: x(
|
|
3270
|
+
pointerType: M.type,
|
|
3271
|
+
position: x(H, p.element),
|
|
3272
3272
|
buttons: D.buttons,
|
|
3273
|
-
insideElementPressed:
|
|
3274
|
-
insideElementReleased:
|
|
3275
|
-
isTouchEvent:
|
|
3273
|
+
insideElementPressed: M.insideElementPressed,
|
|
3274
|
+
insideElementReleased: M.insideElement,
|
|
3275
|
+
isTouchEvent: M.type === "touch",
|
|
3276
3276
|
originalEvent: c.originalEvent,
|
|
3277
3277
|
userData: p.userData
|
|
3278
3278
|
}
|
|
3279
3279
|
), c.preventDefault = !0)));
|
|
3280
3280
|
}
|
|
3281
3281
|
function Q(p, c, g) {
|
|
3282
|
-
var y = t[p.hash], S = p.getActivePointersListByType(g.type), D,
|
|
3282
|
+
var y = t[p.hash], S = p.getActivePointersListByType(g.type), D, H, K;
|
|
3283
3283
|
if (typeof c.originalEvent.buttons < "u" && (S.buttons = c.originalEvent.buttons), D = S.getById(g.id), D)
|
|
3284
3284
|
D.lastPos = D.currentPos, D.lastTime = D.currentTime, D.currentPos = g.currentPos, D.currentTime = g.currentTime;
|
|
3285
3285
|
else
|
|
@@ -3306,13 +3306,13 @@ function Ve() {
|
|
|
3306
3306
|
originalEvent: c.originalEvent,
|
|
3307
3307
|
userData: p.userData
|
|
3308
3308
|
}
|
|
3309
|
-
)), p.dragHandler && !c.preventGesture && !c.defaultPrevented && (D = S.asArray()[0],
|
|
3309
|
+
)), p.dragHandler && !c.preventGesture && !c.defaultPrevented && (D = S.asArray()[0], K = D.currentPos.minus(D.lastPos), p.dragHandler(
|
|
3310
3310
|
{
|
|
3311
3311
|
eventSource: p,
|
|
3312
3312
|
pointerType: D.type,
|
|
3313
3313
|
position: x(D.currentPos, p.element),
|
|
3314
3314
|
buttons: S.buttons,
|
|
3315
|
-
delta:
|
|
3315
|
+
delta: K,
|
|
3316
3316
|
speed: D.speed,
|
|
3317
3317
|
direction: D.direction,
|
|
3318
3318
|
shift: c.originalEvent.shiftKey,
|
|
@@ -3320,17 +3320,17 @@ function Ve() {
|
|
|
3320
3320
|
originalEvent: c.originalEvent,
|
|
3321
3321
|
userData: p.userData
|
|
3322
3322
|
}
|
|
3323
|
-
), c.preventDefault = !0, y.sentDragEvent = !0)) : S.contacts === 2 && (p.moveHandler && (
|
|
3323
|
+
), c.preventDefault = !0, y.sentDragEvent = !0)) : S.contacts === 2 && (p.moveHandler && (H = S.asArray(), p.moveHandler(
|
|
3324
3324
|
{
|
|
3325
3325
|
eventSource: p,
|
|
3326
|
-
pointerType:
|
|
3327
|
-
position: x(E(
|
|
3326
|
+
pointerType: H[0].type,
|
|
3327
|
+
position: x(E(H[0].currentPos, H[1].currentPos), p.element),
|
|
3328
3328
|
buttons: S.buttons,
|
|
3329
|
-
isTouchEvent:
|
|
3329
|
+
isTouchEvent: H[0].type === "touch",
|
|
3330
3330
|
originalEvent: c.originalEvent,
|
|
3331
3331
|
userData: p.userData
|
|
3332
3332
|
}
|
|
3333
|
-
)), p.pinchHandler && g.type === "touch" && !c.preventGesture && !c.defaultPrevented && (
|
|
3333
|
+
)), p.pinchHandler && g.type === "touch" && !c.preventGesture && !c.defaultPrevented && (K = y.pinchGPoints[0].currentPos.distanceTo(y.pinchGPoints[1].currentPos), K !== y.currentPinchDist && (y.lastPinchDist = y.currentPinchDist, y.currentPinchDist = K, y.lastPinchCenter = y.currentPinchCenter, y.currentPinchCenter = E(y.pinchGPoints[0].currentPos, y.pinchGPoints[1].currentPos), p.pinchHandler(
|
|
3334
3334
|
{
|
|
3335
3335
|
eventSource: p,
|
|
3336
3336
|
pointerType: "touch",
|
|
@@ -3347,7 +3347,7 @@ function Ve() {
|
|
|
3347
3347
|
}
|
|
3348
3348
|
function U(p, c, g) {
|
|
3349
3349
|
var y = p.getActivePointersListByType(g.type), S;
|
|
3350
|
-
S = y.getById(g.id), S &&
|
|
3350
|
+
S = y.getById(g.id), S && ce(p, y, S);
|
|
3351
3351
|
}
|
|
3352
3352
|
function ee(p, c, g) {
|
|
3353
3353
|
p.stopHandler && p.stopHandler({
|
|
@@ -3730,18 +3730,18 @@ function Ve() {
|
|
|
3730
3730
|
keyHandler: e.delegate(this, E),
|
|
3731
3731
|
clickHandler: e.delegate(this, P),
|
|
3732
3732
|
dblClickHandler: e.delegate(this, I),
|
|
3733
|
-
dragHandler: e.delegate(this,
|
|
3734
|
-
dragEndHandler: e.delegate(this,
|
|
3733
|
+
dragHandler: e.delegate(this, O),
|
|
3734
|
+
dragEndHandler: e.delegate(this, z),
|
|
3735
3735
|
enterHandler: e.delegate(this, V),
|
|
3736
3736
|
leaveHandler: e.delegate(this, j),
|
|
3737
3737
|
pressHandler: e.delegate(this, Z),
|
|
3738
|
-
releaseHandler: e.delegate(this,
|
|
3739
|
-
nonPrimaryPressHandler: e.delegate(this,
|
|
3740
|
-
nonPrimaryReleaseHandler: e.delegate(this,
|
|
3741
|
-
scrollHandler: e.delegate(this,
|
|
3742
|
-
pinchHandler: e.delegate(this,
|
|
3743
|
-
focusHandler: e.delegate(this,
|
|
3744
|
-
blurHandler: e.delegate(this,
|
|
3738
|
+
releaseHandler: e.delegate(this, $),
|
|
3739
|
+
nonPrimaryPressHandler: e.delegate(this, X),
|
|
3740
|
+
nonPrimaryReleaseHandler: e.delegate(this, B),
|
|
3741
|
+
scrollHandler: e.delegate(this, J),
|
|
3742
|
+
pinchHandler: e.delegate(this, L),
|
|
3743
|
+
focusHandler: e.delegate(this, k),
|
|
3744
|
+
blurHandler: e.delegate(this, q)
|
|
3745
3745
|
}), this.outerTracker = new e.MouseTracker({
|
|
3746
3746
|
userData: "Viewer.outerTracker",
|
|
3747
3747
|
element: this.container,
|
|
@@ -3750,14 +3750,14 @@ function Ve() {
|
|
|
3750
3750
|
clickDistThreshold: this.clickDistThreshold,
|
|
3751
3751
|
dblClickTimeThreshold: this.dblClickTimeThreshold,
|
|
3752
3752
|
dblClickDistThreshold: this.dblClickDistThreshold,
|
|
3753
|
-
enterHandler: e.delegate(this,
|
|
3754
|
-
leaveHandler: e.delegate(this,
|
|
3753
|
+
enterHandler: e.delegate(this, ie),
|
|
3754
|
+
leaveHandler: e.delegate(this, ne)
|
|
3755
3755
|
}), this.toolbar && (this.toolbar = new e.ControlDock({ element: this.toolbar })), this.bindStandardControls(), t[this.hash].prevContainerSize = i(this.container), window.ResizeObserver ? (this._autoResizePolling = !1, this._resizeObserver = new ResizeObserver(function() {
|
|
3756
3756
|
t[_.hash].needsResize = !0;
|
|
3757
3757
|
}), this._resizeObserver.observe(this.container, {})) : this._autoResizePolling = !0, this.world = new e.World({
|
|
3758
3758
|
viewer: this
|
|
3759
3759
|
}), this.world.addHandler("add-item", function(R) {
|
|
3760
|
-
_.source = _.world.getItemAt(0).source, t[_.hash].forceRedraw = !0, _._updateRequestId || (_._updateRequestId = o(_,
|
|
3760
|
+
_.source = _.world.getItemAt(0).source, t[_.hash].forceRedraw = !0, _._updateRequestId || (_._updateRequestId = o(_, se));
|
|
3761
3761
|
}), this.world.addHandler("remove-item", function(R) {
|
|
3762
3762
|
_.world.getItemCount() ? _.source = _.world.getItemAt(0).source : _.source = null, t[_.hash].forceRedraw = !0;
|
|
3763
3763
|
}), this.world.addHandler("metrics-change", function(R) {
|
|
@@ -3792,9 +3792,9 @@ function Ve() {
|
|
|
3792
3792
|
}), this.tileCache = new e.TileCache({
|
|
3793
3793
|
maxImageCacheCount: this.maxImageCacheCount
|
|
3794
3794
|
}), Object.prototype.hasOwnProperty.call(this.drawerOptions, "useCanvas") && (e.console.error('useCanvas is deprecated, use the "drawer" option to indicate preferred drawer(s)'), this.drawerOptions.useCanvas || (this.drawer = e.HTMLDrawer), delete this.drawerOptions.useCanvas);
|
|
3795
|
-
let
|
|
3796
|
-
|
|
3797
|
-
for (const R of
|
|
3795
|
+
let A = Array.isArray(this.drawer) ? this.drawer : [this.drawer];
|
|
3796
|
+
A.length === 0 && (A = [e.DEFAULT_SETTINGS.drawer].flat(), e.console.warn("No valid drawers were selected. Using the default value.")), this.drawer = null;
|
|
3797
|
+
for (const R of A)
|
|
3798
3798
|
if (this.requestDrawer(R, { mainDrawer: !0, redrawImmediately: !1 }))
|
|
3799
3799
|
break;
|
|
3800
3800
|
if (!this.drawer)
|
|
@@ -3884,8 +3884,8 @@ function Ve() {
|
|
|
3884
3884
|
if (e.isArray(u) || (u = [u]), !u.length)
|
|
3885
3885
|
return this;
|
|
3886
3886
|
this._opening = !0;
|
|
3887
|
-
for (var b = u.length, F = 0,
|
|
3888
|
-
if (F +
|
|
3887
|
+
for (var b = u.length, F = 0, A = 0, R, N = function() {
|
|
3888
|
+
if (F + A === b)
|
|
3889
3889
|
if (F) {
|
|
3890
3890
|
(_._firstOpen || !_.preserveViewport) && (_.viewport.goHome(!0), _.viewport.update()), _._firstOpen = !1;
|
|
3891
3891
|
var U = u[0];
|
|
@@ -3895,7 +3895,7 @@ function Ve() {
|
|
|
3895
3895
|
_._drawOverlays(), _._opening = !1, _.raiseEvent("open", { source: U });
|
|
3896
3896
|
} else
|
|
3897
3897
|
_._opening = !1, _.raiseEvent("open-failed", R);
|
|
3898
|
-
},
|
|
3898
|
+
}, Y = function(U) {
|
|
3899
3899
|
(!e.isPlainObject(U) || !U.tileSource) && (U = {
|
|
3900
3900
|
tileSource: U
|
|
3901
3901
|
}), U.index !== void 0 && (e.console.error("[Viewer.open] setting indexes here is not supported; use addTiledImage instead"), delete U.index), U.collectionImmediately === void 0 && (U.collectionImmediately = !0);
|
|
@@ -3908,10 +3908,10 @@ function Ve() {
|
|
|
3908
3908
|
};
|
|
3909
3909
|
var p = U.error;
|
|
3910
3910
|
U.error = function(c) {
|
|
3911
|
-
|
|
3911
|
+
A++, R || (R = c), p && p(c), N();
|
|
3912
3912
|
}, _.addTiledImage(U);
|
|
3913
3913
|
}, Q = 0; Q < u.length; Q++)
|
|
3914
|
-
|
|
3914
|
+
Y(u[Q]);
|
|
3915
3915
|
return this;
|
|
3916
3916
|
},
|
|
3917
3917
|
/**
|
|
@@ -3968,18 +3968,18 @@ function Ve() {
|
|
|
3968
3968
|
drawerOptions: null
|
|
3969
3969
|
};
|
|
3970
3970
|
m = e.extend(!0, _, m);
|
|
3971
|
-
const b = m.mainDrawer, F = m.redrawImmediately,
|
|
3971
|
+
const b = m.mainDrawer, F = m.redrawImmediately, A = m.drawerOptions, R = this.drawer;
|
|
3972
3972
|
let N = null;
|
|
3973
3973
|
if (u && u.prototype instanceof e.DrawerBase ? (N = u, u = "custom") : typeof u == "string" && (N = e.determineDrawer(u)), N || e.console.warn("Unsupported drawer! Drawer must be an existing string type, or a class that extends OpenSeadragon.DrawerBase."), N && N.isSupported()) {
|
|
3974
3974
|
R && b && R.destroy();
|
|
3975
|
-
const
|
|
3975
|
+
const Y = new N({
|
|
3976
3976
|
viewer: this,
|
|
3977
3977
|
viewport: this.viewport,
|
|
3978
3978
|
element: this.canvas,
|
|
3979
3979
|
debugGridColor: this.debugGridColor,
|
|
3980
|
-
options:
|
|
3980
|
+
options: A || this.drawerOptions[u]
|
|
3981
3981
|
});
|
|
3982
|
-
return b && (this.drawer =
|
|
3982
|
+
return b && (this.drawer = Y, F && this.forceRedraw()), Y;
|
|
3983
3983
|
}
|
|
3984
3984
|
return !1;
|
|
3985
3985
|
},
|
|
@@ -4086,7 +4086,7 @@ function Ve() {
|
|
|
4086
4086
|
* @fires OpenSeadragon.Viewer.event:full-page
|
|
4087
4087
|
*/
|
|
4088
4088
|
setFullPage: function(u) {
|
|
4089
|
-
var m = document.body, _ = m.style, b = document.documentElement.style, F = this,
|
|
4089
|
+
var m = document.body, _ = m.style, b = document.documentElement.style, F = this, A, R;
|
|
4090
4090
|
if (u === this.isFullPage())
|
|
4091
4091
|
return this;
|
|
4092
4092
|
var N = {
|
|
@@ -4096,11 +4096,11 @@ function Ve() {
|
|
|
4096
4096
|
if (this.raiseEvent("pre-full-page", N), N.preventDefaultAction)
|
|
4097
4097
|
return this;
|
|
4098
4098
|
if (u && this.element) {
|
|
4099
|
-
for (this.elementSize = e.getElementSize(this.element), this.pageScroll = e.getPageScroll(), this.elementMargin = this.element.style.margin, this.element.style.margin = "0", this.elementPadding = this.element.style.padding, this.element.style.padding = "0", this.bodyMargin = _.margin, this.docMargin = b.margin, _.margin = "0", b.margin = "0", this.bodyPadding = _.padding, this.docPadding = b.padding, _.padding = "0", b.padding = "0", this.bodyWidth = _.width, this.docWidth = b.width, _.width = "100%", b.width = "100%", this.bodyHeight = _.height, this.docHeight = b.height, _.height = "100%", b.height = "100%", this.bodyDisplay = _.display, _.display = "block", this.previousBody = [], t[this.hash].prevElementParent = this.element.parentNode, t[this.hash].prevNextSibling = this.element.nextSibling, t[this.hash].prevElementWidth = this.element.style.width, t[this.hash].prevElementHeight = this.element.style.height,
|
|
4099
|
+
for (this.elementSize = e.getElementSize(this.element), this.pageScroll = e.getPageScroll(), this.elementMargin = this.element.style.margin, this.element.style.margin = "0", this.elementPadding = this.element.style.padding, this.element.style.padding = "0", this.bodyMargin = _.margin, this.docMargin = b.margin, _.margin = "0", b.margin = "0", this.bodyPadding = _.padding, this.docPadding = b.padding, _.padding = "0", b.padding = "0", this.bodyWidth = _.width, this.docWidth = b.width, _.width = "100%", b.width = "100%", this.bodyHeight = _.height, this.docHeight = b.height, _.height = "100%", b.height = "100%", this.bodyDisplay = _.display, _.display = "block", this.previousBody = [], t[this.hash].prevElementParent = this.element.parentNode, t[this.hash].prevNextSibling = this.element.nextSibling, t[this.hash].prevElementWidth = this.element.style.width, t[this.hash].prevElementHeight = this.element.style.height, A = m.childNodes.length, R = 0; R < A; R++)
|
|
4100
4100
|
this.previousBody.push(m.childNodes[0]), m.removeChild(m.childNodes[0]);
|
|
4101
|
-
this.toolbar && this.toolbar.element && (this.toolbar.parentNode = this.toolbar.element.parentNode, this.toolbar.nextSibling = this.toolbar.element.nextSibling, m.appendChild(this.toolbar.element), e.addClass(this.toolbar.element, "fullpage")), e.addClass(this.element, "fullpage"), m.appendChild(this.element), this.element.style.height = "100vh", this.element.style.width = "100vw", this.toolbar && this.toolbar.element && (this.element.style.height = e.getElementSize(this.element).y - e.getElementSize(this.toolbar.element).y + "px"), t[this.hash].fullPage = !0, e.delegate(this,
|
|
4101
|
+
this.toolbar && this.toolbar.element && (this.toolbar.parentNode = this.toolbar.element.parentNode, this.toolbar.nextSibling = this.toolbar.element.nextSibling, m.appendChild(this.toolbar.element), e.addClass(this.toolbar.element, "fullpage")), e.addClass(this.element, "fullpage"), m.appendChild(this.element), this.element.style.height = "100vh", this.element.style.width = "100vw", this.toolbar && this.toolbar.element && (this.element.style.height = e.getElementSize(this.element).y - e.getElementSize(this.toolbar.element).y + "px"), t[this.hash].fullPage = !0, e.delegate(this, ie)({});
|
|
4102
4102
|
} else {
|
|
4103
|
-
for (this.element.style.margin = this.elementMargin, this.element.style.padding = this.elementPadding, _.margin = this.bodyMargin, b.margin = this.docMargin, _.padding = this.bodyPadding, b.padding = this.docPadding, _.width = this.bodyWidth, b.width = this.docWidth, _.height = this.bodyHeight, b.height = this.docHeight, _.display = this.bodyDisplay, m.removeChild(this.element),
|
|
4103
|
+
for (this.element.style.margin = this.elementMargin, this.element.style.padding = this.elementPadding, _.margin = this.bodyMargin, b.margin = this.docMargin, _.padding = this.bodyPadding, b.padding = this.docPadding, _.width = this.bodyWidth, b.width = this.docWidth, _.height = this.bodyHeight, b.height = this.docHeight, _.display = this.bodyDisplay, m.removeChild(this.element), A = this.previousBody.length, R = 0; R < A; R++)
|
|
4104
4104
|
m.appendChild(this.previousBody.shift());
|
|
4105
4105
|
e.removeClass(this.element, "fullpage"), t[this.hash].prevElementParent.insertBefore(
|
|
4106
4106
|
this.element,
|
|
@@ -4109,12 +4109,12 @@ function Ve() {
|
|
|
4109
4109
|
this.toolbar.element,
|
|
4110
4110
|
this.toolbar.nextSibling
|
|
4111
4111
|
), delete this.toolbar.parentNode, delete this.toolbar.nextSibling), this.element.style.width = t[this.hash].prevElementWidth, this.element.style.height = t[this.hash].prevElementHeight;
|
|
4112
|
-
var
|
|
4112
|
+
var Y = 0, Q = function() {
|
|
4113
4113
|
e.setPageScroll(F.pageScroll);
|
|
4114
4114
|
var U = e.getPageScroll();
|
|
4115
|
-
|
|
4115
|
+
Y++, Y < 10 && (U.x !== F.pageScroll.x || U.y !== F.pageScroll.y) && e.requestAnimationFrame(Q);
|
|
4116
4116
|
};
|
|
4117
|
-
e.requestAnimationFrame(Q), t[this.hash].fullPage = !1, e.delegate(this,
|
|
4117
|
+
e.requestAnimationFrame(Q), t[this.hash].fullPage = !1, e.delegate(this, ne)({});
|
|
4118
4118
|
}
|
|
4119
4119
|
return this.navigator && this.viewport && this.navigator.update(this.viewport), this.raiseEvent("full-page", { fullPage: u }), this;
|
|
4120
4120
|
},
|
|
@@ -4281,8 +4281,8 @@ function Ve() {
|
|
|
4281
4281
|
return;
|
|
4282
4282
|
}
|
|
4283
4283
|
this._loadQueue.push(_);
|
|
4284
|
-
function
|
|
4285
|
-
for (var R, N,
|
|
4284
|
+
function A() {
|
|
4285
|
+
for (var R, N, Y; m._loadQueue.length && (R = m._loadQueue[0], !!R.tileSource); ) {
|
|
4286
4286
|
if (m._loadQueue.splice(0, 1), R.options.replace) {
|
|
4287
4287
|
var Q = m.world.getIndexOfItem(R.options.replaceItem);
|
|
4288
4288
|
Q !== -1 && (R.options.index = Q), m.world.removeItem(R.options.replaceItem);
|
|
@@ -4325,12 +4325,12 @@ function Ve() {
|
|
|
4325
4325
|
ajaxHeaders: R.options.ajaxHeaders,
|
|
4326
4326
|
debugMode: m.debugMode,
|
|
4327
4327
|
subPixelRoundingForTransparency: m.subPixelRoundingForTransparency
|
|
4328
|
-
}), m.collectionMode && m.world.setAutoRefigureSizes(!1), m.navigator && (
|
|
4328
|
+
}), m.collectionMode && m.world.setAutoRefigureSizes(!1), m.navigator && (Y = e.extend({}, R.options, {
|
|
4329
4329
|
replace: !1,
|
|
4330
4330
|
// navigator already removed the layer, nothing to replace
|
|
4331
4331
|
originalTiledImage: N,
|
|
4332
4332
|
tileSource: R.tileSource
|
|
4333
|
-
}), m.navigator.addTiledImage(
|
|
4333
|
+
}), m.navigator.addTiledImage(Y)), m.world.addItem(N, {
|
|
4334
4334
|
index: R.options.index
|
|
4335
4335
|
}), m._loadQueue.length === 0 && F(R), m.world.getItemCount() === 1 && !m.preserveViewport && m.viewport.goHome(!0), R.options.success && R.options.success({
|
|
4336
4336
|
item: N
|
|
@@ -4338,9 +4338,9 @@ function Ve() {
|
|
|
4338
4338
|
}
|
|
4339
4339
|
}
|
|
4340
4340
|
r(this, u.tileSource, u, function(R) {
|
|
4341
|
-
_.tileSource = R,
|
|
4341
|
+
_.tileSource = R, A();
|
|
4342
4342
|
}, function(R) {
|
|
4343
|
-
R.options = u, b(R),
|
|
4343
|
+
R.options = u, b(R), A();
|
|
4344
4344
|
});
|
|
4345
4345
|
},
|
|
4346
4346
|
/**
|
|
@@ -4419,8 +4419,8 @@ function Ve() {
|
|
|
4419
4419
|
* @returns {OpenSeadragon.Viewer} Chainable.
|
|
4420
4420
|
*/
|
|
4421
4421
|
bindSequenceControls: function() {
|
|
4422
|
-
var u = e.delegate(this, v), m = e.delegate(this, w), _ = e.delegate(this, this.goToNextPage), b = e.delegate(this, this.goToPreviousPage), F = this.navImages,
|
|
4423
|
-
return this.showSequenceControl && ((this.previousButton || this.nextButton) && (
|
|
4422
|
+
var u = e.delegate(this, v), m = e.delegate(this, w), _ = e.delegate(this, this.goToNextPage), b = e.delegate(this, this.goToPreviousPage), F = this.navImages, A = !0;
|
|
4423
|
+
return this.showSequenceControl && ((this.previousButton || this.nextButton) && (A = !1), this.previousButton = new e.Button({
|
|
4424
4424
|
element: this.previousButton ? e.getElement(this.previousButton) : null,
|
|
4425
4425
|
clickTimeThreshold: this.clickTimeThreshold,
|
|
4426
4426
|
clickDistThreshold: this.clickDistThreshold,
|
|
@@ -4444,7 +4444,7 @@ function Ve() {
|
|
|
4444
4444
|
onRelease: _,
|
|
4445
4445
|
onFocus: u,
|
|
4446
4446
|
onBlur: m
|
|
4447
|
-
}), this.navPrevNextWrap || this.previousButton.disable(), (!this.tileSources || !this.tileSources.length) && this.nextButton.disable(),
|
|
4447
|
+
}), this.navPrevNextWrap || this.previousButton.disable(), (!this.tileSources || !this.tileSources.length) && this.nextButton.disable(), A && (this.paging = new e.ButtonGroup({
|
|
4448
4448
|
buttons: [
|
|
4449
4449
|
this.previousButton,
|
|
4450
4450
|
this.nextButton
|
|
@@ -4464,7 +4464,7 @@ function Ve() {
|
|
|
4464
4464
|
* @returns {OpenSeadragon.Viewer} Chainable.
|
|
4465
4465
|
*/
|
|
4466
4466
|
bindStandardControls: function() {
|
|
4467
|
-
var u = e.delegate(this,
|
|
4467
|
+
var u = e.delegate(this, fe), m = e.delegate(this, me), _ = e.delegate(this, _e), b = e.delegate(this, ge), F = e.delegate(this, ye), A = e.delegate(this, Ee), R = e.delegate(this, Te), N = e.delegate(this, Se), Y = e.delegate(this, pe), Q = e.delegate(this, ce), U = e.delegate(this, v), ee = e.delegate(this, w), p = this.navImages, c = [], g = !0;
|
|
4468
4468
|
return this.showNavigationControl && ((this.zoomInButton || this.zoomOutButton || this.homeButton || this.fullPageButton || this.rotateLeftButton || this.rotateRightButton || this.flipButton) && (g = !1), this.showZoomControl && (c.push(this.zoomInButton = new e.Button({
|
|
4469
4469
|
element: this.zoomInButton ? e.getElement(this.zoomInButton) : null,
|
|
4470
4470
|
clickTimeThreshold: this.clickTimeThreshold,
|
|
@@ -4506,7 +4506,7 @@ function Ve() {
|
|
|
4506
4506
|
srcGroup: G(this.prefixUrl, p.home.GROUP),
|
|
4507
4507
|
srcHover: G(this.prefixUrl, p.home.HOVER),
|
|
4508
4508
|
srcDown: G(this.prefixUrl, p.home.DOWN),
|
|
4509
|
-
onRelease:
|
|
4509
|
+
onRelease: A,
|
|
4510
4510
|
onFocus: U,
|
|
4511
4511
|
onBlur: ee
|
|
4512
4512
|
})), this.showFullPageControl && c.push(this.fullPageButton = new e.Button({
|
|
@@ -4542,7 +4542,7 @@ function Ve() {
|
|
|
4542
4542
|
srcGroup: G(this.prefixUrl, p.rotateright.GROUP),
|
|
4543
4543
|
srcHover: G(this.prefixUrl, p.rotateright.HOVER),
|
|
4544
4544
|
srcDown: G(this.prefixUrl, p.rotateright.DOWN),
|
|
4545
|
-
onRelease:
|
|
4545
|
+
onRelease: Y,
|
|
4546
4546
|
onFocus: U,
|
|
4547
4547
|
onBlur: ee
|
|
4548
4548
|
}))), this.showFlipControl && c.push(this.flipButton = new e.Button({
|
|
@@ -4561,7 +4561,7 @@ function Ve() {
|
|
|
4561
4561
|
buttons: c,
|
|
4562
4562
|
clickTimeThreshold: this.clickTimeThreshold,
|
|
4563
4563
|
clickDistThreshold: this.clickDistThreshold
|
|
4564
|
-
}), this.navControl = this.buttonGroup.element, this.addHandler("open", e.delegate(this,
|
|
4564
|
+
}), this.navControl = this.buttonGroup.element, this.addHandler("open", e.delegate(this, we)), this.toolbar ? this.toolbar.addControl(
|
|
4565
4565
|
this.navControl,
|
|
4566
4566
|
{ anchor: this.navigationControlAnchor || e.ControlAnchor.TOP_LEFT }
|
|
4567
4567
|
) : this.addControl(
|
|
@@ -4615,8 +4615,8 @@ function Ve() {
|
|
|
4615
4615
|
onDraw: b
|
|
4616
4616
|
}, u = e.getElement(F.element), s(this.currentOverlays, u) >= 0)
|
|
4617
4617
|
return this;
|
|
4618
|
-
var
|
|
4619
|
-
return this.currentOverlays.push(
|
|
4618
|
+
var A = a(this, F);
|
|
4619
|
+
return this.currentOverlays.push(A), A.drawHTML(this.overlaysContainer, this.viewport), this.raiseEvent("add-overlay", {
|
|
4620
4620
|
element: u,
|
|
4621
4621
|
location: F.location,
|
|
4622
4622
|
placement: F.placement
|
|
@@ -4830,7 +4830,7 @@ function Ve() {
|
|
|
4830
4830
|
);
|
|
4831
4831
|
}
|
|
4832
4832
|
function r(u, m, _, b, F) {
|
|
4833
|
-
var
|
|
4833
|
+
var A = u;
|
|
4834
4834
|
if (e.type(m) === "string") {
|
|
4835
4835
|
if (m.match(/^\s*<.*>\s*$/))
|
|
4836
4836
|
m = e.parseXml(m);
|
|
@@ -4841,10 +4841,10 @@ function Ve() {
|
|
|
4841
4841
|
} catch {
|
|
4842
4842
|
}
|
|
4843
4843
|
}
|
|
4844
|
-
function N(
|
|
4845
|
-
|
|
4846
|
-
b(
|
|
4847
|
-
}),
|
|
4844
|
+
function N(Y, Q) {
|
|
4845
|
+
Y.ready ? b(Y) : (Y.addHandler("ready", function() {
|
|
4846
|
+
b(Y);
|
|
4847
|
+
}), Y.addHandler("open-failed", function(U) {
|
|
4848
4848
|
F({
|
|
4849
4849
|
message: U.message,
|
|
4850
4850
|
source: Q
|
|
@@ -4867,10 +4867,10 @@ function Ve() {
|
|
|
4867
4867
|
});
|
|
4868
4868
|
else if (e.isPlainObject(m) || m.nodeType)
|
|
4869
4869
|
if (m.crossOriginPolicy === void 0 && (_.crossOriginPolicy !== void 0 || u.crossOriginPolicy !== void 0) && (m.crossOriginPolicy = _.crossOriginPolicy !== void 0 ? _.crossOriginPolicy : u.crossOriginPolicy), m.ajaxWithCredentials === void 0 && (m.ajaxWithCredentials = u.ajaxWithCredentials), e.isFunction(m.getTileUrl)) {
|
|
4870
|
-
var
|
|
4871
|
-
|
|
4870
|
+
var Y = new e.TileSource(m);
|
|
4871
|
+
Y.getTileUrl = m.getTileUrl, b(Y);
|
|
4872
4872
|
} else {
|
|
4873
|
-
var Q = e.TileSource.determineType(
|
|
4873
|
+
var Q = e.TileSource.determineType(A, m);
|
|
4874
4874
|
if (!Q) {
|
|
4875
4875
|
F({
|
|
4876
4876
|
message: "Unable to load TileSource",
|
|
@@ -4878,7 +4878,7 @@ function Ve() {
|
|
|
4878
4878
|
});
|
|
4879
4879
|
return;
|
|
4880
4880
|
}
|
|
4881
|
-
var U = Q.prototype.configure.apply(
|
|
4881
|
+
var U = Q.prototype.configure.apply(A, [m]);
|
|
4882
4882
|
N(new Q(U), m);
|
|
4883
4883
|
}
|
|
4884
4884
|
else
|
|
@@ -4898,19 +4898,19 @@ function Ve() {
|
|
|
4898
4898
|
m.className ? m.className : "openseadragon-overlay"
|
|
4899
4899
|
);
|
|
4900
4900
|
}
|
|
4901
|
-
var F = m.location,
|
|
4901
|
+
var F = m.location, A = m.width, R = m.height;
|
|
4902
4902
|
if (!F) {
|
|
4903
|
-
var N = m.x,
|
|
4903
|
+
var N = m.x, Y = m.y;
|
|
4904
4904
|
if (m.px !== void 0) {
|
|
4905
4905
|
var Q = u.viewport.imageToViewportRectangle(new e.Rect(
|
|
4906
4906
|
m.px,
|
|
4907
4907
|
m.py,
|
|
4908
|
-
|
|
4908
|
+
A || 0,
|
|
4909
4909
|
R || 0
|
|
4910
4910
|
));
|
|
4911
|
-
N = Q.x,
|
|
4911
|
+
N = Q.x, Y = Q.y, A = A !== void 0 ? Q.width : void 0, R = R !== void 0 ? Q.height : void 0;
|
|
4912
4912
|
}
|
|
4913
|
-
F = new e.Point(N,
|
|
4913
|
+
F = new e.Point(N, Y);
|
|
4914
4914
|
}
|
|
4915
4915
|
var U = m.placement;
|
|
4916
4916
|
return U && e.type(U) === "string" && (U = e.Placement[m.placement.toUpperCase()]), new e.Overlay({
|
|
@@ -4919,7 +4919,7 @@ function Ve() {
|
|
|
4919
4919
|
placement: U,
|
|
4920
4920
|
onDraw: m.onDraw,
|
|
4921
4921
|
checkResize: m.checkResize,
|
|
4922
|
-
width:
|
|
4922
|
+
width: A,
|
|
4923
4923
|
height: R,
|
|
4924
4924
|
rotationMode: m.rotationMode
|
|
4925
4925
|
});
|
|
@@ -5071,7 +5071,7 @@ function Ve() {
|
|
|
5071
5071
|
m.zoomToRefPoint ? this.viewport.pointFromPixel(u.position, !0) : null
|
|
5072
5072
|
), this.viewport.applyConstraints()));
|
|
5073
5073
|
}
|
|
5074
|
-
function
|
|
5074
|
+
function O(u) {
|
|
5075
5075
|
var m, _ = {
|
|
5076
5076
|
tracker: u.eventSource,
|
|
5077
5077
|
pointerType: u.pointerType,
|
|
@@ -5091,14 +5091,14 @@ function Ve() {
|
|
|
5091
5091
|
if (this.panHorizontal || (u.delta.x = 0), this.panVertical || (u.delta.y = 0), this.viewport.flipped && (u.delta.x = -u.delta.x), this.constrainDuringPan) {
|
|
5092
5092
|
var F = this.viewport.deltaPointsFromPixels(u.delta.negate());
|
|
5093
5093
|
this.viewport.centerSpringX.target.value += F.x, this.viewport.centerSpringY.target.value += F.y;
|
|
5094
|
-
var
|
|
5095
|
-
this.viewport.centerSpringX.target.value -= F.x, this.viewport.centerSpringY.target.value -= F.y,
|
|
5094
|
+
var A = this.viewport.getConstrainedBounds();
|
|
5095
|
+
this.viewport.centerSpringX.target.value -= F.x, this.viewport.centerSpringY.target.value -= F.y, A.xConstrained && (u.delta.x = 0), A.yConstrained && (u.delta.y = 0);
|
|
5096
5096
|
}
|
|
5097
5097
|
this.viewport.panBy(this.viewport.deltaPointsFromPixels(u.delta.negate()), m.flickEnabled && !this.constrainDuringPan);
|
|
5098
5098
|
}
|
|
5099
5099
|
}
|
|
5100
5100
|
}
|
|
5101
|
-
function
|
|
5101
|
+
function z(u) {
|
|
5102
5102
|
var m, _ = {
|
|
5103
5103
|
tracker: u.eventSource,
|
|
5104
5104
|
pointerType: u.pointerType,
|
|
@@ -5115,10 +5115,10 @@ function Ve() {
|
|
|
5115
5115
|
this.panHorizontal && (b = m.flickMomentum * u.speed * Math.cos(u.direction));
|
|
5116
5116
|
var F = 0;
|
|
5117
5117
|
this.panVertical && (F = m.flickMomentum * u.speed * Math.sin(u.direction));
|
|
5118
|
-
var
|
|
5118
|
+
var A = this.viewport.pixelFromPoint(
|
|
5119
5119
|
this.viewport.getCenter(!0)
|
|
5120
5120
|
), R = this.viewport.pointFromPixel(
|
|
5121
|
-
new e.Point(
|
|
5121
|
+
new e.Point(A.x - b, A.y - F)
|
|
5122
5122
|
);
|
|
5123
5123
|
this.viewport.panTo(R, !1);
|
|
5124
5124
|
}
|
|
@@ -5166,7 +5166,7 @@ function Ve() {
|
|
|
5166
5166
|
b - _ < this.dblClickTimeThreshold && (t[this.hash].draggingToZoom = !0), t[this.hash].lastClickTime = null;
|
|
5167
5167
|
}
|
|
5168
5168
|
}
|
|
5169
|
-
function
|
|
5169
|
+
function $(u) {
|
|
5170
5170
|
this.raiseEvent("canvas-release", {
|
|
5171
5171
|
tracker: u.eventSource,
|
|
5172
5172
|
pointerType: u.pointerType,
|
|
@@ -5176,7 +5176,7 @@ function Ve() {
|
|
|
5176
5176
|
originalEvent: u.originalEvent
|
|
5177
5177
|
});
|
|
5178
5178
|
}
|
|
5179
|
-
function
|
|
5179
|
+
function X(u) {
|
|
5180
5180
|
this.raiseEvent("canvas-nonprimary-press", {
|
|
5181
5181
|
tracker: u.eventSource,
|
|
5182
5182
|
position: u.position,
|
|
@@ -5186,7 +5186,7 @@ function Ve() {
|
|
|
5186
5186
|
originalEvent: u.originalEvent
|
|
5187
5187
|
});
|
|
5188
5188
|
}
|
|
5189
|
-
function
|
|
5189
|
+
function B(u) {
|
|
5190
5190
|
this.raiseEvent("canvas-nonprimary-release", {
|
|
5191
5191
|
tracker: u.eventSource,
|
|
5192
5192
|
position: u.position,
|
|
@@ -5196,8 +5196,8 @@ function Ve() {
|
|
|
5196
5196
|
originalEvent: u.originalEvent
|
|
5197
5197
|
});
|
|
5198
5198
|
}
|
|
5199
|
-
function
|
|
5200
|
-
var m, _, b, F,
|
|
5199
|
+
function L(u) {
|
|
5200
|
+
var m, _, b, F, A = {
|
|
5201
5201
|
tracker: u.eventSource,
|
|
5202
5202
|
pointerType: u.pointerType,
|
|
5203
5203
|
gesturePoints: u.gesturePoints,
|
|
@@ -5211,7 +5211,7 @@ function Ve() {
|
|
|
5211
5211
|
preventDefaultZoomAction: !1,
|
|
5212
5212
|
preventDefaultRotateAction: !1
|
|
5213
5213
|
};
|
|
5214
|
-
if (this.raiseEvent("canvas-pinch",
|
|
5214
|
+
if (this.raiseEvent("canvas-pinch", A), this.viewport && (m = this.gestureSettingsByDeviceType(u.pointerType), m.pinchToZoom && (!A.preventDefaultPanAction || !A.preventDefaultZoomAction) && (_ = this.viewport.pointFromPixel(u.center, !0), m.zoomToRefPoint && !A.preventDefaultPanAction && (b = this.viewport.pointFromPixel(u.lastCenter, !0), F = b.minus(_), this.panHorizontal || (F.x = 0), this.panVertical || (F.y = 0), this.viewport.panBy(F, !0)), A.preventDefaultZoomAction || this.viewport.zoomBy(u.distance / u.lastDistance, _, !0), this.viewport.applyConstraints()), m.pinchRotate && !A.preventDefaultRotateAction)) {
|
|
5215
5215
|
var R = Math.atan2(
|
|
5216
5216
|
u.gesturePoints[0].currentPos.y - u.gesturePoints[1].currentPos.y,
|
|
5217
5217
|
u.gesturePoints[0].currentPos.x - u.gesturePoints[1].currentPos.x
|
|
@@ -5222,21 +5222,21 @@ function Ve() {
|
|
|
5222
5222
|
_ = this.viewport.pointFromPixel(u.center, !0), this.viewport.rotateTo(this.viewport.getRotation(!0) + (R - N) * (180 / Math.PI), _, !0);
|
|
5223
5223
|
}
|
|
5224
5224
|
}
|
|
5225
|
-
function
|
|
5225
|
+
function k(u) {
|
|
5226
5226
|
this.raiseEvent("canvas-focus", {
|
|
5227
5227
|
tracker: u.eventSource,
|
|
5228
5228
|
originalEvent: u.originalEvent
|
|
5229
5229
|
});
|
|
5230
5230
|
}
|
|
5231
|
-
function
|
|
5231
|
+
function q(u) {
|
|
5232
5232
|
this.raiseEvent("canvas-blur", {
|
|
5233
5233
|
tracker: u.eventSource,
|
|
5234
5234
|
originalEvent: u.originalEvent
|
|
5235
5235
|
});
|
|
5236
5236
|
}
|
|
5237
|
-
function
|
|
5238
|
-
var m, _, b, F,
|
|
5239
|
-
F = e.now(),
|
|
5237
|
+
function J(u) {
|
|
5238
|
+
var m, _, b, F, A;
|
|
5239
|
+
F = e.now(), A = F - this._lastScrollTime, A > this.minScrollDeltaTime ? (this._lastScrollTime = F, m = {
|
|
5240
5240
|
tracker: u.eventSource,
|
|
5241
5241
|
position: u.position,
|
|
5242
5242
|
scroll: u.scroll,
|
|
@@ -5249,7 +5249,7 @@ function Ve() {
|
|
|
5249
5249
|
_.zoomToRefPoint ? this.viewport.pointFromPixel(u.position, !0) : null
|
|
5250
5250
|
), this.viewport.applyConstraints())), u.preventDefault = m.preventDefault) : u.preventDefault = !0;
|
|
5251
5251
|
}
|
|
5252
|
-
function
|
|
5252
|
+
function ie(u) {
|
|
5253
5253
|
t[this.hash].mouseInside = !0, f(this), this.raiseEvent("container-enter", {
|
|
5254
5254
|
tracker: u.eventSource,
|
|
5255
5255
|
pointerType: u.pointerType,
|
|
@@ -5261,7 +5261,7 @@ function Ve() {
|
|
|
5261
5261
|
originalEvent: u.originalEvent
|
|
5262
5262
|
});
|
|
5263
5263
|
}
|
|
5264
|
-
function
|
|
5264
|
+
function ne(u) {
|
|
5265
5265
|
u.pointers < 1 && (t[this.hash].mouseInside = !1, t[this.hash].animating || h(this)), this.raiseEvent("container-exit", {
|
|
5266
5266
|
tracker: u.eventSource,
|
|
5267
5267
|
pointerType: u.pointerType,
|
|
@@ -5273,22 +5273,22 @@ function Ve() {
|
|
|
5273
5273
|
originalEvent: u.originalEvent
|
|
5274
5274
|
});
|
|
5275
5275
|
}
|
|
5276
|
-
function
|
|
5277
|
-
|
|
5276
|
+
function se(u) {
|
|
5277
|
+
le(u), u.isOpen() ? u._updateRequestId = o(u, se) : u._updateRequestId = !1;
|
|
5278
5278
|
}
|
|
5279
5279
|
function ae(u, m) {
|
|
5280
5280
|
var _ = u.viewport, b = _.getZoom(), F = _.getCenter();
|
|
5281
5281
|
_.resize(m, u.preserveImageSizeOnResize), _.panTo(F, !0);
|
|
5282
|
-
var
|
|
5282
|
+
var A;
|
|
5283
5283
|
if (u.preserveImageSizeOnResize)
|
|
5284
|
-
|
|
5284
|
+
A = t[u.hash].prevContainerSize.x / m.x;
|
|
5285
5285
|
else {
|
|
5286
|
-
var R = new e.Point(0, 0), N = new e.Point(t[u.hash].prevContainerSize.x, t[u.hash].prevContainerSize.y).distanceTo(R),
|
|
5287
|
-
|
|
5286
|
+
var R = new e.Point(0, 0), N = new e.Point(t[u.hash].prevContainerSize.x, t[u.hash].prevContainerSize.y).distanceTo(R), Y = new e.Point(m.x, m.y).distanceTo(R);
|
|
5287
|
+
A = Y / N * t[u.hash].prevContainerSize.x / m.x;
|
|
5288
5288
|
}
|
|
5289
|
-
_.zoomTo(b *
|
|
5289
|
+
_.zoomTo(b * A, null, !0), t[u.hash].prevContainerSize = m, t[u.hash].forceRedraw = !0, t[u.hash].needsResize = !1, t[u.hash].forceResize = !1;
|
|
5290
5290
|
}
|
|
5291
|
-
function
|
|
5291
|
+
function le(u) {
|
|
5292
5292
|
if (!(u._opening || !t[u.hash])) {
|
|
5293
5293
|
if (u.autoResize || t[u.hash].forceResize) {
|
|
5294
5294
|
var m;
|
|
@@ -5301,51 +5301,51 @@ function Ve() {
|
|
|
5301
5301
|
}
|
|
5302
5302
|
var b = u.viewport.update(), F = u.world.update(b) || b;
|
|
5303
5303
|
b && u.raiseEvent("viewport-change"), u.referenceStrip && (F = u.referenceStrip.update(u.viewport) || F);
|
|
5304
|
-
var
|
|
5305
|
-
!
|
|
5306
|
-
var R =
|
|
5307
|
-
R && (t[u.hash].animating = !1), (F || R || t[u.hash].forceRedraw || u.world.needsDraw()) && (
|
|
5304
|
+
var A = t[u.hash].animating;
|
|
5305
|
+
!A && F && (u.raiseEvent("animation-start"), f(u));
|
|
5306
|
+
var R = A && !F;
|
|
5307
|
+
R && (t[u.hash].animating = !1), (F || R || t[u.hash].forceRedraw || u.world.needsDraw()) && (he(u), u._drawOverlays(), u.navigator && u.navigator.update(u.viewport), t[u.hash].forceRedraw = !1, F && u.raiseEvent("animation")), R && (u.raiseEvent("animation-finish"), t[u.hash].mouseInside || h(u)), t[u.hash].animating = F;
|
|
5308
5308
|
}
|
|
5309
5309
|
}
|
|
5310
|
-
function
|
|
5310
|
+
function he(u) {
|
|
5311
5311
|
u.imageLoader.clear(), u.world.draw(), u.raiseEvent("update-viewport", {});
|
|
5312
5312
|
}
|
|
5313
5313
|
function G(u, m) {
|
|
5314
5314
|
return u ? u + m : m;
|
|
5315
5315
|
}
|
|
5316
|
-
function
|
|
5317
|
-
t[this.hash].lastZoomTime = e.now(), t[this.hash].zoomFactor = this.zoomPerSecond, t[this.hash].zooming = !0,
|
|
5316
|
+
function fe() {
|
|
5317
|
+
t[this.hash].lastZoomTime = e.now(), t[this.hash].zoomFactor = this.zoomPerSecond, t[this.hash].zooming = !0, ue(this);
|
|
5318
5318
|
}
|
|
5319
|
-
function
|
|
5320
|
-
t[this.hash].lastZoomTime = e.now(), t[this.hash].zoomFactor = 1 / this.zoomPerSecond, t[this.hash].zooming = !0,
|
|
5319
|
+
function ge() {
|
|
5320
|
+
t[this.hash].lastZoomTime = e.now(), t[this.hash].zoomFactor = 1 / this.zoomPerSecond, t[this.hash].zooming = !0, ue(this);
|
|
5321
5321
|
}
|
|
5322
|
-
function
|
|
5322
|
+
function me() {
|
|
5323
5323
|
t[this.hash].zooming = !1;
|
|
5324
5324
|
}
|
|
5325
|
-
function
|
|
5326
|
-
e.requestAnimationFrame(e.delegate(u,
|
|
5325
|
+
function ue(u) {
|
|
5326
|
+
e.requestAnimationFrame(e.delegate(u, ve));
|
|
5327
5327
|
}
|
|
5328
|
-
function
|
|
5328
|
+
function ve() {
|
|
5329
5329
|
var u, m, _;
|
|
5330
|
-
t[this.hash].zooming && this.viewport && (u = e.now(), m = u - t[this.hash].lastZoomTime, _ = Math.pow(t[this.hash].zoomFactor, m / 1e3), this.viewport.zoomBy(_), this.viewport.applyConstraints(), t[this.hash].lastZoomTime = u,
|
|
5330
|
+
t[this.hash].zooming && this.viewport && (u = e.now(), m = u - t[this.hash].lastZoomTime, _ = Math.pow(t[this.hash].zoomFactor, m / 1e3), this.viewport.zoomBy(_), this.viewport.applyConstraints(), t[this.hash].lastZoomTime = u, ue(this));
|
|
5331
5331
|
}
|
|
5332
5332
|
function _e() {
|
|
5333
5333
|
this.viewport && (t[this.hash].zooming = !1, this.viewport.zoomBy(
|
|
5334
5334
|
this.zoomPerClick / 1
|
|
5335
5335
|
), this.viewport.applyConstraints());
|
|
5336
5336
|
}
|
|
5337
|
-
function
|
|
5337
|
+
function ye() {
|
|
5338
5338
|
this.viewport && (t[this.hash].zooming = !1, this.viewport.zoomBy(
|
|
5339
5339
|
1 / this.zoomPerClick
|
|
5340
5340
|
), this.viewport.applyConstraints());
|
|
5341
5341
|
}
|
|
5342
|
-
function
|
|
5342
|
+
function we() {
|
|
5343
5343
|
this.buttonGroup && (this.buttonGroup.emulateEnter(), this.buttonGroup.emulateLeave());
|
|
5344
5344
|
}
|
|
5345
5345
|
function Ee() {
|
|
5346
5346
|
this.viewport && this.viewport.goHome();
|
|
5347
5347
|
}
|
|
5348
|
-
function
|
|
5348
|
+
function Te() {
|
|
5349
5349
|
this.isFullPage() && !e.isFullScreen() ? this.setFullPage(!1) : this.setFullScreen(!this.isFullPage()), this.buttonGroup && this.buttonGroup.emulateLeave(), this.fullPageButton.element.focus(), this.viewport && this.viewport.applyConstraints();
|
|
5350
5350
|
}
|
|
5351
5351
|
function Se() {
|
|
@@ -5354,13 +5354,13 @@ function Ve() {
|
|
|
5354
5354
|
this.viewport.flipped ? u += this.rotationIncrement : u -= this.rotationIncrement, this.viewport.setRotation(u);
|
|
5355
5355
|
}
|
|
5356
5356
|
}
|
|
5357
|
-
function
|
|
5357
|
+
function pe() {
|
|
5358
5358
|
if (this.viewport) {
|
|
5359
5359
|
var u = this.viewport.getRotation();
|
|
5360
5360
|
this.viewport.flipped ? u -= this.rotationIncrement : u += this.rotationIncrement, this.viewport.setRotation(u);
|
|
5361
5361
|
}
|
|
5362
5362
|
}
|
|
5363
|
-
function
|
|
5363
|
+
function ce() {
|
|
5364
5364
|
this.viewport.toggleFlip();
|
|
5365
5365
|
}
|
|
5366
5366
|
e.determineDrawer = function(u) {
|
|
@@ -6669,8 +6669,8 @@ function Ve() {
|
|
|
6669
6669
|
var l = null;
|
|
6670
6670
|
return this.levels.length > 0 && a >= this.minLevel && a <= this.maxLevel && (l = this.levels[a].url), l;
|
|
6671
6671
|
}
|
|
6672
|
-
var h = "0", d = Math.pow(0.5, this.maxLevel - a), f, v, w, T, x, E, P, I,
|
|
6673
|
-
return this.levelSizes ? (f = this.levelSizes[a].width, v = this.levelSizes[a].height) : (f = Math.ceil(this.width * d), v = Math.ceil(this.height * d)), w = this.getTileWidth(a), T = this.getTileHeight(a), x = Math.round(w / d), E = Math.round(T / d), this.version === 1 ?
|
|
6672
|
+
var h = "0", d = Math.pow(0.5, this.maxLevel - a), f, v, w, T, x, E, P, I, O, z, V, j, Z, $, X, B;
|
|
6673
|
+
return this.levelSizes ? (f = this.levelSizes[a].width, v = this.levelSizes[a].height) : (f = Math.ceil(this.width * d), v = Math.ceil(this.height * d)), w = this.getTileWidth(a), T = this.getTileHeight(a), x = Math.round(w / d), E = Math.round(T / d), this.version === 1 ? X = "native." + this.tileFormat : X = "default." + this.tileFormat, f < w && v < T ? (this.version === 2 && f === this.width ? j = "full" : this.version === 3 && f === this.width && v === this.height ? j = "max" : this.version === 3 ? j = f + "," + v : j = f + ",", P = "full") : (I = s * x, O = o * E, z = Math.min(x, this.width - I), V = Math.min(E, this.height - O), s === 0 && o === 0 && z === this.width && V === this.height ? P = "full" : P = [I, O, z, V].join(","), Z = Math.min(w, f - s * w), $ = Math.min(T, v - o * T), this.version === 2 && Z === this.width ? j = "full" : this.version === 3 && Z === this.width && $ === this.height ? j = "max" : this.version === 3 ? j = Z + "," + $ : j = Z + ","), B = [this._id, P, j, h, X].join("/"), B;
|
|
6674
6674
|
},
|
|
6675
6675
|
__testonly__: {
|
|
6676
6676
|
canBeTiled: t,
|
|
@@ -7531,7 +7531,7 @@ function Ve() {
|
|
|
7531
7531
|
this.containsPoint(f, n) && i.push(f);
|
|
7532
7532
|
for (var v = this._getSegments(), w = t._getSegments(), T = 0; T < v.length; T++)
|
|
7533
7533
|
for (var x = v[T], E = 0; E < w.length; E++) {
|
|
7534
|
-
var P = w[E], I =
|
|
7534
|
+
var P = w[E], I = O(
|
|
7535
7535
|
x[0],
|
|
7536
7536
|
x[1],
|
|
7537
7537
|
P[0],
|
|
@@ -7539,20 +7539,20 @@ function Ve() {
|
|
|
7539
7539
|
);
|
|
7540
7540
|
I && i.push(I);
|
|
7541
7541
|
}
|
|
7542
|
-
function B
|
|
7543
|
-
var
|
|
7544
|
-
if (
|
|
7542
|
+
function O(B, L, k, q) {
|
|
7543
|
+
var J = L.minus(B), ie = q.minus(k), ne = -ie.x * J.y + J.x * ie.y;
|
|
7544
|
+
if (ne === 0)
|
|
7545
7545
|
return null;
|
|
7546
|
-
var
|
|
7547
|
-
return -1e-10 <=
|
|
7546
|
+
var se = (J.x * (B.y - k.y) - J.y * (B.x - k.x)) / ne, ae = (ie.x * (B.y - k.y) - ie.y * (B.x - k.x)) / ne;
|
|
7547
|
+
return -1e-10 <= se && se <= 1 - n && -1e-10 <= ae && ae <= 1 - n ? new e.Point(B.x + ae * J.x, B.y + ae * J.y) : null;
|
|
7548
7548
|
}
|
|
7549
7549
|
if (i.length === 0)
|
|
7550
7550
|
return null;
|
|
7551
|
-
for (var
|
|
7552
|
-
var
|
|
7553
|
-
|
|
7551
|
+
for (var z = i[0].x, V = i[0].x, j = i[0].y, Z = i[0].y, $ = 1; $ < i.length; $++) {
|
|
7552
|
+
var X = i[$];
|
|
7553
|
+
X.x < z && (z = X.x), X.x > V && (V = X.x), X.y < j && (j = X.y), X.y > Z && (Z = X.y);
|
|
7554
7554
|
}
|
|
7555
|
-
return new e.Rect(
|
|
7555
|
+
return new e.Rect(z, j, V - z, Z - j);
|
|
7556
7556
|
},
|
|
7557
7557
|
// private
|
|
7558
7558
|
_getSegments: function() {
|
|
@@ -7720,13 +7720,13 @@ function Ve() {
|
|
|
7720
7720
|
var w, T, x, E, P, I;
|
|
7721
7721
|
for (d.scroll === "horizontal" ? w = d.panelWidth : w = d.panelHeight, T = Math.ceil(f / w) + 5, x = Math.ceil((Math.abs(v) + f) / w) + 1, T = x - T, T = T < 0 ? 0 : T, P = T; P < x && P < d.panels.length; P++)
|
|
7722
7722
|
if (I = d.panels[P], !I.activePanel) {
|
|
7723
|
-
var
|
|
7724
|
-
|
|
7723
|
+
var O, z = d.viewer.tileSources[P];
|
|
7724
|
+
z.referenceStripThumbnailUrl ? O = {
|
|
7725
7725
|
type: "image",
|
|
7726
|
-
url:
|
|
7727
|
-
} :
|
|
7726
|
+
url: z.referenceStripThumbnailUrl
|
|
7727
|
+
} : O = z, E = new e.Viewer({
|
|
7728
7728
|
id: I.id,
|
|
7729
|
-
tileSources: [
|
|
7729
|
+
tileSources: [O],
|
|
7730
7730
|
element: I,
|
|
7731
7731
|
navigatorSizeRatio: d.sizeRatio,
|
|
7732
7732
|
showNavigator: !1,
|
|
@@ -8720,7 +8720,7 @@ function Ve() {
|
|
|
8720
8720
|
*
|
|
8721
8721
|
*/
|
|
8722
8722
|
_drawTiles(l) {
|
|
8723
|
-
var h = l.getTilesToDraw().map((
|
|
8723
|
+
var h = l.getTilesToDraw().map((B) => B.tile);
|
|
8724
8724
|
if (!(l.opacity === 0 || h.length === 0 && !l.placeholderFillStyle)) {
|
|
8725
8725
|
var d = h[0], f;
|
|
8726
8726
|
d && (f = l.opacity < 1 || l.compositeOperation && l.compositeOperation !== "source-over" || !l._isBottomItem() && l.source.hasTransparency(d.context2D, d.getUrl(), d.ajaxHeaders, d.postData));
|
|
@@ -8739,40 +8739,40 @@ function Ve() {
|
|
|
8739
8739
|
this._saveContext(f);
|
|
8740
8740
|
var I = l.imageToViewportRectangle(l._clip, !0);
|
|
8741
8741
|
I = I.rotate(-l.getRotation(!0), l._getRotationPoint(!0));
|
|
8742
|
-
var
|
|
8743
|
-
v && (
|
|
8742
|
+
var O = this.viewportToDrawerRectangle(I);
|
|
8743
|
+
v && (O = O.times(v)), w && (O = O.translate(w)), this._setClip(O, f), P = !0;
|
|
8744
8744
|
}
|
|
8745
8745
|
if (l._croppingPolygons) {
|
|
8746
|
-
var
|
|
8746
|
+
var z = this;
|
|
8747
8747
|
P || this._saveContext(f);
|
|
8748
8748
|
try {
|
|
8749
|
-
var V = l._croppingPolygons.map(function(
|
|
8750
|
-
return
|
|
8751
|
-
var
|
|
8752
|
-
return v && (
|
|
8749
|
+
var V = l._croppingPolygons.map(function(B) {
|
|
8750
|
+
return B.map(function(L) {
|
|
8751
|
+
var k = l.imageToViewportCoordinates(L.x, L.y, !0).rotate(-l.getRotation(!0), l._getRotationPoint(!0)), q = z.viewportCoordToDrawerCoord(k);
|
|
8752
|
+
return v && (q = q.times(v)), w && (q = q.plus(w)), q;
|
|
8753
8753
|
});
|
|
8754
8754
|
});
|
|
8755
8755
|
this._clipWithPolygons(V, f);
|
|
8756
|
-
} catch (
|
|
8757
|
-
e.console.error(
|
|
8756
|
+
} catch (B) {
|
|
8757
|
+
e.console.error(B);
|
|
8758
8758
|
}
|
|
8759
8759
|
P = !0;
|
|
8760
8760
|
}
|
|
8761
8761
|
if (l._hasOpaqueTile = !1, l.placeholderFillStyle && l._hasOpaqueTile === !1) {
|
|
8762
|
-
let
|
|
8763
|
-
v && (
|
|
8764
|
-
let
|
|
8765
|
-
typeof l.placeholderFillStyle == "function" ?
|
|
8762
|
+
let B = this.viewportToDrawerRectangle(l.getBoundsNoRotate(!0));
|
|
8763
|
+
v && (B = B.times(v)), w && (B = B.translate(w));
|
|
8764
|
+
let L = null;
|
|
8765
|
+
typeof l.placeholderFillStyle == "function" ? L = l.placeholderFillStyle(l, this.context) : L = l.placeholderFillStyle, this._drawRectangle(B, L, f);
|
|
8766
8766
|
}
|
|
8767
8767
|
var j = s(l.subPixelRoundingForTransparency), Z = !1;
|
|
8768
8768
|
if (j === e.SUBPIXEL_ROUNDING_OCCURRENCES.ALWAYS)
|
|
8769
8769
|
Z = !0;
|
|
8770
8770
|
else if (j === e.SUBPIXEL_ROUNDING_OCCURRENCES.ONLY_AT_REST) {
|
|
8771
|
-
var
|
|
8772
|
-
Z =
|
|
8771
|
+
var $ = this.viewer && this.viewer.isAnimating();
|
|
8772
|
+
Z = !$;
|
|
8773
8773
|
}
|
|
8774
|
-
for (var
|
|
8775
|
-
d = h[
|
|
8774
|
+
for (var X = 0; X < h.length; X++)
|
|
8775
|
+
d = h[X], this._drawTile(
|
|
8776
8776
|
d,
|
|
8777
8777
|
l,
|
|
8778
8778
|
f,
|
|
@@ -8881,13 +8881,13 @@ function Ve() {
|
|
|
8881
8881
|
E.x,
|
|
8882
8882
|
E.y
|
|
8883
8883
|
)), this._raiseTileDrawingEvent(d, h, l, P);
|
|
8884
|
-
var I,
|
|
8885
|
-
l.sourceBounds ? (I = Math.min(l.sourceBounds.width, P.canvas.width),
|
|
8884
|
+
var I, O;
|
|
8885
|
+
l.sourceBounds ? (I = Math.min(l.sourceBounds.width, P.canvas.width), O = Math.min(l.sourceBounds.height, P.canvas.height)) : (I = P.canvas.width, O = P.canvas.height), h.translate(x.x + E.x / 2, 0), l.flipped && h.scale(-1, 1), h.drawImage(
|
|
8886
8886
|
P.canvas,
|
|
8887
8887
|
0,
|
|
8888
8888
|
0,
|
|
8889
8889
|
I,
|
|
8890
|
-
|
|
8890
|
+
O,
|
|
8891
8891
|
-E.x / 2,
|
|
8892
8892
|
x.y,
|
|
8893
8893
|
E.x,
|
|
@@ -9248,27 +9248,27 @@ function Ve() {
|
|
|
9248
9248
|
return;
|
|
9249
9249
|
let E = x[0], P = w.compositeOperation || this.viewer.compositeOperation || w._clip || w._croppingPolygons || w.debugMode, I = P || w.opacity < 1 || E.hasTransparency;
|
|
9250
9250
|
P && (v && this._outputContext.drawImage(this._renderingCanvas, 0, 0), r.bindFramebuffer(r.FRAMEBUFFER, null), r.clear(r.COLOR_BUFFER_BIT)), r.useProgram(this._firstPass.shaderProgram), I ? (r.bindFramebuffer(r.FRAMEBUFFER, this._glFrameBuffer), r.clear(r.COLOR_BUFFER_BIT)) : r.bindFramebuffer(r.FRAMEBUFFER, null);
|
|
9251
|
-
let
|
|
9252
|
-
if (
|
|
9253
|
-
let
|
|
9254
|
-
|
|
9251
|
+
let O = f, z = w.getRotation(!0);
|
|
9252
|
+
if (z % 360 !== 0) {
|
|
9253
|
+
let B = e.Mat3.makeRotation(-z * Math.PI / 180), L = w.getBoundsNoRotate(!0).getCenter(), k = e.Mat3.makeTranslation(L.x, L.y), q = e.Mat3.makeTranslation(-L.x, -L.y), J = k.multiply(B).multiply(q);
|
|
9254
|
+
O = f.multiply(J);
|
|
9255
9255
|
}
|
|
9256
9256
|
let V = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS);
|
|
9257
9257
|
if (V <= 0)
|
|
9258
9258
|
throw new Error(`WegGL error: bad value for gl parameter MAX_TEXTURE_IMAGE_UNITS (${V}). This could happen
|
|
9259
9259
|
if too many contexts have been created and not released, or there is another problem with the graphics card.`);
|
|
9260
|
-
let j = new Float32Array(V * 12), Z = new Array(V),
|
|
9261
|
-
for (let
|
|
9262
|
-
let
|
|
9263
|
-
if (
|
|
9264
|
-
for (let
|
|
9265
|
-
r.activeTexture(r.TEXTURE0 +
|
|
9266
|
-
r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferTexturePosition), r.bufferData(r.ARRAY_BUFFER, j, r.DYNAMIC_DRAW),
|
|
9267
|
-
r.uniformMatrix3fv(this._firstPass.uTransformMatrices[
|
|
9268
|
-
}), r.uniform1fv(this._firstPass.uOpacities, new Float32Array(
|
|
9260
|
+
let j = new Float32Array(V * 12), Z = new Array(V), $ = new Array(V), X = new Array(V);
|
|
9261
|
+
for (let B = 0; B < x.length; B++) {
|
|
9262
|
+
let L = x[B].tile, k = B % V, q = k + 1, J = L.getCanvasContext(), ie = J ? this._TextureMap.get(J.canvas) : null;
|
|
9263
|
+
if (ie || (this._tileReadyHandler({ tile: L, tiledImage: w }), ie = J ? this._TextureMap.get(J.canvas) : null), ie && this._getTileData(L, w, ie, O, k, j, Z, $, X), q === V || B === x.length - 1) {
|
|
9264
|
+
for (let ne = 0; ne <= q; ne++)
|
|
9265
|
+
r.activeTexture(r.TEXTURE0 + ne), r.bindTexture(r.TEXTURE_2D, Z[ne]);
|
|
9266
|
+
r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferTexturePosition), r.bufferData(r.ARRAY_BUFFER, j, r.DYNAMIC_DRAW), $.forEach((ne, se) => {
|
|
9267
|
+
r.uniformMatrix3fv(this._firstPass.uTransformMatrices[se], !1, ne);
|
|
9268
|
+
}), r.uniform1fv(this._firstPass.uOpacities, new Float32Array(X)), r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferOutputPosition), r.vertexAttribPointer(this._firstPass.aOutputPosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferTexturePosition), r.vertexAttribPointer(this._firstPass.aTexturePosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._firstPass.bufferIndex), r.vertexAttribPointer(this._firstPass.aIndex, 1, r.FLOAT, !1, 0, 0), r.drawArrays(r.TRIANGLES, 0, 6 * q);
|
|
9269
9269
|
}
|
|
9270
9270
|
}
|
|
9271
|
-
I && (r.useProgram(this._secondPass.shaderProgram), r.bindFramebuffer(r.FRAMEBUFFER, null), r.activeTexture(r.TEXTURE0), r.bindTexture(r.TEXTURE_2D, this._renderToTexture), this._gl.uniform1f(this._secondPass.uOpacityMultiplier, w.opacity), r.bindBuffer(r.ARRAY_BUFFER, this._secondPass.bufferTexturePosition), r.vertexAttribPointer(this._secondPass.aTexturePosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._secondPass.bufferOutputPosition), r.vertexAttribPointer(this._secondPass.aOutputPosition, 2, r.FLOAT, !1, 0, 0), r.drawArrays(r.TRIANGLES, 0, 6)), v = !0, P && (this._applyContext2dPipeline(w, x, T), v = !1, r.bindFramebuffer(r.FRAMEBUFFER, null), r.clear(r.COLOR_BUFFER_BIT)), T === 0 && this._raiseTiledImageDrawnEvent(w, x.map((
|
|
9271
|
+
I && (r.useProgram(this._secondPass.shaderProgram), r.bindFramebuffer(r.FRAMEBUFFER, null), r.activeTexture(r.TEXTURE0), r.bindTexture(r.TEXTURE_2D, this._renderToTexture), this._gl.uniform1f(this._secondPass.uOpacityMultiplier, w.opacity), r.bindBuffer(r.ARRAY_BUFFER, this._secondPass.bufferTexturePosition), r.vertexAttribPointer(this._secondPass.aTexturePosition, 2, r.FLOAT, !1, 0, 0), r.bindBuffer(r.ARRAY_BUFFER, this._secondPass.bufferOutputPosition), r.vertexAttribPointer(this._secondPass.aOutputPosition, 2, r.FLOAT, !1, 0, 0), r.drawArrays(r.TRIANGLES, 0, 6)), v = !0, P && (this._applyContext2dPipeline(w, x, T), v = !1, r.bindFramebuffer(r.FRAMEBUFFER, null), r.clear(r.COLOR_BUFFER_BIT)), T === 0 && this._raiseTiledImageDrawnEvent(w, x.map((B) => B.tile));
|
|
9272
9272
|
}
|
|
9273
9273
|
}), v && this._outputContext.drawImage(this._renderingCanvas, 0, 0);
|
|
9274
9274
|
}
|
|
@@ -9314,7 +9314,7 @@ function Ve() {
|
|
|
9314
9314
|
_getTileData(i, r, a, s, o, l, h, d, f) {
|
|
9315
9315
|
let v = a.texture, w = a.position;
|
|
9316
9316
|
l.set(w, o * 12);
|
|
9317
|
-
let T = this._calculateOverlapFraction(i, r), x = i.positionedBounds.width * T.x, E = i.positionedBounds.height * T.y, P = i.positionedBounds.x + (i.x === 0 ? 0 : x), I = i.positionedBounds.y + (i.y === 0 ? 0 : E),
|
|
9317
|
+
let T = this._calculateOverlapFraction(i, r), x = i.positionedBounds.width * T.x, E = i.positionedBounds.height * T.y, P = i.positionedBounds.x + (i.x === 0 ? 0 : x), I = i.positionedBounds.y + (i.y === 0 ? 0 : E), O = i.positionedBounds.x + i.positionedBounds.width - (i.isRightMost ? 0 : x), z = i.positionedBounds.y + i.positionedBounds.height - (i.isBottomMost ? 0 : E), V = O - P, j = z - I, Z = new e.Mat3([
|
|
9318
9318
|
V,
|
|
9319
9319
|
0,
|
|
9320
9320
|
0,
|
|
@@ -9326,11 +9326,11 @@ function Ve() {
|
|
|
9326
9326
|
1
|
|
9327
9327
|
]);
|
|
9328
9328
|
if (i.flipped) {
|
|
9329
|
-
let
|
|
9330
|
-
Z = Z.multiply(
|
|
9329
|
+
let X = e.Mat3.makeTranslation(0.5, 0), B = e.Mat3.makeTranslation(-0.5, 0), L = X.multiply(e.Mat3.makeScaling(-1, 1)).multiply(B);
|
|
9330
|
+
Z = Z.multiply(L);
|
|
9331
9331
|
}
|
|
9332
|
-
let
|
|
9333
|
-
f[o] = i.opacity, h[o] = v, d[o] =
|
|
9332
|
+
let $ = s.multiply(Z);
|
|
9333
|
+
f[o] = i.opacity, h[o] = v, d[o] = $.values;
|
|
9334
9334
|
}
|
|
9335
9335
|
// private
|
|
9336
9336
|
_textureFilter() {
|
|
@@ -9507,8 +9507,8 @@ function Ve() {
|
|
|
9507
9507
|
if (!this._TextureMap.get(o)) {
|
|
9508
9508
|
let h = this._gl, d = h.createTexture(), f, v = a.source.tileOverlap, w, T;
|
|
9509
9509
|
if (r.sourceBounds ? (w = Math.min(r.sourceBounds.width, o.width) / o.width, T = Math.min(r.sourceBounds.height, o.height) / o.height) : (w = 1, T = 1), v > 0) {
|
|
9510
|
-
let E = this._calculateOverlapFraction(r, a), P = (r.x === 0 ? 0 : E.x) * w, I = (r.y === 0 ? 0 : E.y) * T,
|
|
9511
|
-
f = this._makeQuadVertexBuffer(P,
|
|
9510
|
+
let E = this._calculateOverlapFraction(r, a), P = (r.x === 0 ? 0 : E.x) * w, I = (r.y === 0 ? 0 : E.y) * T, O = (r.isRightMost ? 1 : 1 - E.x) * w, z = (r.isBottomMost ? 1 : 1 - E.y) * T;
|
|
9511
|
+
f = this._makeQuadVertexBuffer(P, O, I, z);
|
|
9512
9512
|
} else w === 1 && T === 1 ? f = this._unitQuad : f = this._makeQuadVertexBuffer(0, w, 0, T);
|
|
9513
9513
|
let x = {
|
|
9514
9514
|
texture: d,
|
|
@@ -11648,33 +11648,33 @@ function Ve() {
|
|
|
11648
11648
|
// returns boolean flag of whether the image should be marked as fully loaded
|
|
11649
11649
|
_updateLevelsForViewport: function() {
|
|
11650
11650
|
var t = this._getLevelsInterval(), n = t.lowestLevel, i = t.highestLevel, r = [], a = this.getDrawArea(), s = e.now();
|
|
11651
|
-
if (this._lastDrawn.forEach((
|
|
11652
|
-
|
|
11651
|
+
if (this._lastDrawn.forEach((O) => {
|
|
11652
|
+
O.tile.beingDrawn = !1;
|
|
11653
11653
|
}), this._tilesToDraw = [], this._tilesLoading = 0, this.loadingCoverage = {}, !a)
|
|
11654
11654
|
return this._needsDraw = !1, this._fullyLoaded;
|
|
11655
11655
|
var o = new Array(i - n + 1);
|
|
11656
|
-
for (let
|
|
11657
|
-
o[
|
|
11658
|
-
for (let
|
|
11659
|
-
var l = this.tilesMatrix[
|
|
11656
|
+
for (let O = 0, z = i; z >= n; z--, O++)
|
|
11657
|
+
o[O] = z;
|
|
11658
|
+
for (let O = i + 1; O <= this.source.maxLevel; O++) {
|
|
11659
|
+
var l = this.tilesMatrix[O] && this.tilesMatrix[O][0] && this.tilesMatrix[O][0][0];
|
|
11660
11660
|
if (l && l.isBottomMost && l.isRightMost && l.loaded) {
|
|
11661
|
-
o.push(
|
|
11661
|
+
o.push(O);
|
|
11662
11662
|
break;
|
|
11663
11663
|
}
|
|
11664
11664
|
}
|
|
11665
11665
|
let h = !1;
|
|
11666
|
-
for (let
|
|
11667
|
-
let
|
|
11666
|
+
for (let O = 0; O < o.length; O++) {
|
|
11667
|
+
let z = o[O];
|
|
11668
11668
|
var d = this.viewport.deltaPixelsFromPointsNoRotate(
|
|
11669
|
-
this.source.getPixelRatio(
|
|
11669
|
+
this.source.getPixelRatio(z),
|
|
11670
11670
|
!0
|
|
11671
11671
|
).x * this._scaleSpring.current.value;
|
|
11672
|
-
if (
|
|
11672
|
+
if (O === o.length - 1 || d >= this.minPixelRatio)
|
|
11673
11673
|
h = !0;
|
|
11674
11674
|
else if (!h)
|
|
11675
11675
|
continue;
|
|
11676
11676
|
var f = this.viewport.deltaPixelsFromPointsNoRotate(
|
|
11677
|
-
this.source.getPixelRatio(
|
|
11677
|
+
this.source.getPixelRatio(z),
|
|
11678
11678
|
!1
|
|
11679
11679
|
).x * this._scaleSpring.current.value, v = this.viewport.deltaPixelsFromPointsNoRotate(
|
|
11680
11680
|
this.source.getPixelRatio(
|
|
@@ -11687,7 +11687,7 @@ function Ve() {
|
|
|
11687
11687
|
).x * this._scaleSpring.current.value, w = this.immediateRender ? 1 : v, T = Math.min(1, (d - 0.5) / 0.5), x = w / Math.abs(
|
|
11688
11688
|
w - f
|
|
11689
11689
|
), E = this._updateLevel(
|
|
11690
|
-
|
|
11690
|
+
z,
|
|
11691
11691
|
T,
|
|
11692
11692
|
x,
|
|
11693
11693
|
a,
|
|
@@ -11696,20 +11696,20 @@ function Ve() {
|
|
|
11696
11696
|
);
|
|
11697
11697
|
r = E.bestTiles;
|
|
11698
11698
|
var P = E.updatedTiles.filter((V) => V.loaded), I = /* @__PURE__ */ function(V, j, Z) {
|
|
11699
|
-
return function(
|
|
11699
|
+
return function($) {
|
|
11700
11700
|
return {
|
|
11701
|
-
tile:
|
|
11701
|
+
tile: $,
|
|
11702
11702
|
level: V,
|
|
11703
11703
|
levelOpacity: j,
|
|
11704
11704
|
currentTime: Z
|
|
11705
11705
|
};
|
|
11706
11706
|
};
|
|
11707
|
-
}(
|
|
11708
|
-
if (this._tilesToDraw[
|
|
11707
|
+
}(z, T, s);
|
|
11708
|
+
if (this._tilesToDraw[z] = P.map(I), this._providesCoverage(this.coverage, z))
|
|
11709
11709
|
break;
|
|
11710
11710
|
}
|
|
11711
|
-
return r && r.length > 0 ? (r.forEach(function(
|
|
11712
|
-
|
|
11711
|
+
return r && r.length > 0 ? (r.forEach(function(O) {
|
|
11712
|
+
O && !O.context2D && this._loadTile(O, s);
|
|
11713
11713
|
}, this), this._needsDraw = !0, !1) : this._tilesLoading === 0;
|
|
11714
11714
|
},
|
|
11715
11715
|
/**
|
|
@@ -11797,15 +11797,15 @@ function Ve() {
|
|
|
11797
11797
|
this.getFlip() && (f.x += 1, this.wrapHorizontal || (f.x = Math.min(f.x, v.x - 1)));
|
|
11798
11798
|
for (var T = Math.max(0, (f.x - d.x) * (f.y - d.y)), x = new Array(T), E = 0, P = d.x; P <= f.x; P++)
|
|
11799
11799
|
for (var I = d.y; I <= f.y; I++) {
|
|
11800
|
-
var
|
|
11800
|
+
var O;
|
|
11801
11801
|
if (this.getFlip()) {
|
|
11802
|
-
var
|
|
11803
|
-
|
|
11802
|
+
var z = (v.x + P % v.x) % v.x;
|
|
11803
|
+
O = P + v.x - z - z - 1;
|
|
11804
11804
|
} else
|
|
11805
|
-
|
|
11806
|
-
if (r.intersection(this.getTileBounds(t,
|
|
11805
|
+
O = P;
|
|
11806
|
+
if (r.intersection(this.getTileBounds(t, O, I)) !== null) {
|
|
11807
11807
|
var V = this._updateTile(
|
|
11808
|
-
|
|
11808
|
+
O,
|
|
11809
11809
|
I,
|
|
11810
11810
|
t,
|
|
11811
11811
|
i,
|
|
@@ -12438,7 +12438,7 @@ function Ve() {
|
|
|
12438
12438
|
}
|
|
12439
12439
|
);
|
|
12440
12440
|
}(C);
|
|
12441
|
-
}(
|
|
12441
|
+
}(xe)), xe.exports;
|
|
12442
12442
|
}
|
|
12443
12443
|
var je = Ve();
|
|
12444
12444
|
const qe = /* @__PURE__ */ Be(je), Ze = (W, C = [255, 255, 255, 255], e = [0, 0, 0, 255]) => {
|
|
@@ -12504,7 +12504,7 @@ const qe = /* @__PURE__ */ Be(je), Ze = (W, C = [255, 255, 255, 255], e = [0, 0,
|
|
|
12504
12504
|
}
|
|
12505
12505
|
}).observe(e), C.appendChild(t), { canvas: t, ctx: n };
|
|
12506
12506
|
}, Ke = (W) => {
|
|
12507
|
-
const { bounds: C, scale: e } =
|
|
12507
|
+
const { bounds: C, scale: e } = Ie(
|
|
12508
12508
|
{ h: W.height, w: W.width },
|
|
12509
12509
|
{ h: 1024, w: 1024 }
|
|
12510
12510
|
), t = document.createElement("canvas");
|
|
@@ -12524,7 +12524,7 @@ const qe = /* @__PURE__ */ Be(je), Ze = (W, C = [255, 255, 255, 255], e = [0, 0,
|
|
|
12524
12524
|
e.setAttribute("class", "a9s-sam a9s-osd-sam-preview"), e.style.display = "none";
|
|
12525
12525
|
const n = (o, l) => {
|
|
12526
12526
|
t.clearRect(0, 0, e.width, e.height);
|
|
12527
|
-
const { canvas: h, ratio: d } =
|
|
12527
|
+
const { canvas: h, ratio: d } = Le(
|
|
12528
12528
|
o,
|
|
12529
12529
|
l,
|
|
12530
12530
|
[0, 0, 0, 0],
|
|
@@ -12579,106 +12579,113 @@ const qe = /* @__PURE__ */ Be(je), Ze = (W, C = [255, 255, 255, 255], e = [0, 0,
|
|
|
12579
12579
|
}), rt = (W, C = {}) => {
|
|
12580
12580
|
const { viewer: e } = W;
|
|
12581
12581
|
let t = !1, n = "add";
|
|
12582
|
-
const i = We(), r = et(), a = Qe(W.viewer, C), s = $e(W.viewer), o = (
|
|
12583
|
-
const { isSAMReady:
|
|
12584
|
-
if (!
|
|
12585
|
-
const q = e.drawer.canvas, J = q.width / (
|
|
12586
|
-
return { x: ne, y:
|
|
12587
|
-
}, l = (
|
|
12582
|
+
const i = We(), r = et(), a = Qe(W.viewer, C), s = $e(W.viewer), o = (B) => {
|
|
12583
|
+
const { isSAMReady: L, sam: k } = r;
|
|
12584
|
+
if (!k || !L) return;
|
|
12585
|
+
const q = e.drawer.canvas, J = q.width / (k.currentScale * q.offsetWidth), ie = q.height / (k.currentScale * q.offsetHeight), ne = B.x * J + k.currentBounds.x, se = B.y * ie + k.currentBounds.y;
|
|
12586
|
+
return { x: ne, y: se };
|
|
12587
|
+
}, l = (B) => {
|
|
12588
12588
|
var q;
|
|
12589
12589
|
if (!r.isSAMReady || !r.isOSDReady || !!((q = r.sam) != null && q.currentPrompt)) return;
|
|
12590
|
-
const
|
|
12591
|
-
r.lastPointerPos =
|
|
12592
|
-
}, h = (
|
|
12593
|
-
var
|
|
12594
|
-
const
|
|
12595
|
-
if (!
|
|
12596
|
-
|
|
12597
|
-
include: ((
|
|
12598
|
-
exclude: [...((
|
|
12590
|
+
const k = { x: B.offsetX, y: B.offsetY };
|
|
12591
|
+
r.lastPointerPos = k, r.isAnimationInProgress || w(k);
|
|
12592
|
+
}, h = (B) => {
|
|
12593
|
+
var se, ae, le, he;
|
|
12594
|
+
const L = { x: B.offsetX, y: B.offsetY }, k = o(L);
|
|
12595
|
+
if (!k) return;
|
|
12596
|
+
B.shiftKey || n === "remove" ? r.sam.currentPrompt = {
|
|
12597
|
+
include: ((se = r.sam.currentPrompt) == null ? void 0 : se.include) || [],
|
|
12598
|
+
exclude: [...((ae = r.sam.currentPrompt) == null ? void 0 : ae.exclude) || [], k]
|
|
12599
12599
|
} : r.sam.currentPrompt = {
|
|
12600
|
-
include: [...((
|
|
12601
|
-
exclude: ((
|
|
12600
|
+
include: [...((le = r.sam.currentPrompt) == null ? void 0 : le.include) || [], k],
|
|
12601
|
+
exclude: ((he = r.sam.currentPrompt) == null ? void 0 : he.exclude) || []
|
|
12602
12602
|
};
|
|
12603
|
-
const { currentPrompt: q, currentBounds: J, currentScale:
|
|
12604
|
-
s.setPrompt(q, J,
|
|
12605
|
-
}, d = (
|
|
12606
|
-
|
|
12607
|
-
}, f = (
|
|
12608
|
-
e.isMouseNavEnabled() || h(
|
|
12603
|
+
const { currentPrompt: q, currentBounds: J, currentScale: ie, currentAnnotationId: ne } = r.sam;
|
|
12604
|
+
s.setPrompt(q, J, ie), X.postMessage({ type: "decode", prompt: r.sam.currentPrompt });
|
|
12605
|
+
}, d = (B) => {
|
|
12606
|
+
B.quick && (!r.sam || !r.isSAMReady || !r.isOSDReady || r.isAnimationInProgress || (e.setMouseNavEnabled(!1), h(B.originalEvent)));
|
|
12607
|
+
}, f = (B) => {
|
|
12608
|
+
e.isMouseNavEnabled() || h(B);
|
|
12609
12609
|
}, v = () => {
|
|
12610
12610
|
if (!r.sam) return;
|
|
12611
12611
|
r.viewportVersion += 1, i.emit("encodingStart");
|
|
12612
|
-
const
|
|
12613
|
-
|
|
12614
|
-
}, w = (
|
|
12615
|
-
const
|
|
12616
|
-
|
|
12612
|
+
const B = ke(r.sam.currentCanvas);
|
|
12613
|
+
X.postMessage({ type: "encode", data: B, viewportVersion: r.viewportVersion });
|
|
12614
|
+
}, w = (B) => {
|
|
12615
|
+
const L = o(B);
|
|
12616
|
+
L && X.postMessage({ type: "decode_preview", point: L });
|
|
12617
12617
|
}, T = () => {
|
|
12618
12618
|
r.isAnimationInProgress = !0, i.emit("animationStart"), r.sam = void 0, a.clear(), s.clear();
|
|
12619
12619
|
}, x = () => {
|
|
12620
|
-
|
|
12621
|
-
const { canvas: O, bounds: A, scale: z } = Ke(e.drawer.canvas);
|
|
12620
|
+
const { canvas: B, bounds: L, scale: k } = Ke(e.drawer.canvas);
|
|
12622
12621
|
r.sam = {
|
|
12623
12622
|
// The current 1024 x 1024 SAM working canvas
|
|
12624
|
-
currentCanvas:
|
|
12623
|
+
currentCanvas: B,
|
|
12625
12624
|
// The bbox of the resized & padded viewport on the working canvas
|
|
12626
|
-
currentBounds:
|
|
12625
|
+
currentBounds: L,
|
|
12627
12626
|
// The current SAM scale (longer image dimension / 1024)
|
|
12628
|
-
currentScale:
|
|
12627
|
+
currentScale: k,
|
|
12629
12628
|
// New annotation ID for the current shape
|
|
12630
12629
|
currentAnnotationId: Ne()
|
|
12631
|
-
}
|
|
12630
|
+
};
|
|
12631
|
+
}, E = () => {
|
|
12632
|
+
r.isAnimationInProgress = !1, i.emit("animationStart"), !(!r.isOSDReady || !t) && (x(), r.isSAMReady && v());
|
|
12633
|
+
}, P = () => {
|
|
12634
|
+
t = !0, a.show(), s.show(), I(), r.sam || x();
|
|
12632
12635
|
};
|
|
12633
12636
|
Ye(e, () => {
|
|
12634
|
-
console.log("[a9s-sam] OSD canvas ready"), r.isOSDReady = !0,
|
|
12637
|
+
console.log("[a9s-sam] OSD canvas ready"), r.isOSDReady = !0, E();
|
|
12635
12638
|
});
|
|
12636
|
-
const
|
|
12637
|
-
e.element.addEventListener("pointermove", l), e.element.addEventListener("pointerdown", f), e.addHandler("animation-start", T), e.addHandler("animation-finish",
|
|
12638
|
-
},
|
|
12639
|
-
var
|
|
12640
|
-
(
|
|
12641
|
-
},
|
|
12642
|
-
|
|
12643
|
-
t = !0, (O = r.sam) != null && O.currentPrompt && i.emit("promptChanged", void 0), r.sam = void 0, a.show(), s.show(), E(), x();
|
|
12644
|
-
}, k = () => {
|
|
12645
|
-
t = !1, e.setMouseNavEnabled(!0), a.hide(), s.hide(), P();
|
|
12646
|
-
}, V = () => {
|
|
12647
|
-
k(), B();
|
|
12639
|
+
const I = () => {
|
|
12640
|
+
e.element.addEventListener("pointermove", l), e.element.addEventListener("pointerdown", f), e.addHandler("animation-start", T), e.addHandler("animation-finish", E), e.addHandler("canvas-click", d);
|
|
12641
|
+
}, O = () => {
|
|
12642
|
+
var B, L;
|
|
12643
|
+
(B = e.element) == null || B.removeEventListener("pointermove", l), (L = e.element) == null || L.removeEventListener("pointerdown", f), e == null || e.removeHandler("animation-start", T), e == null || e.removeHandler("animation-finish", E), e == null || e.removeHandler("canvas-click", d);
|
|
12644
|
+
}, z = (B) => n = B, V = () => {
|
|
12645
|
+
t = !1, e.setMouseNavEnabled(!0), a.hide(), s.hide(), O();
|
|
12648
12646
|
}, j = () => {
|
|
12649
|
-
|
|
12647
|
+
V(), P();
|
|
12650
12648
|
}, Z = () => {
|
|
12651
|
-
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12649
|
+
if (r.sam) {
|
|
12650
|
+
const B = W.state.store.getAnnotation(r.sam.currentAnnotationId);
|
|
12651
|
+
B && (W.removeAnnotation(r.sam.currentAnnotationId), i.emit("deleteAnnotation", B));
|
|
12652
|
+
}
|
|
12653
|
+
j();
|
|
12654
|
+
}, $ = () => {
|
|
12655
|
+
a.destroy(), s.destroy(), O();
|
|
12656
|
+
}, X = new ze();
|
|
12657
|
+
return X.onmessage = (B) => {
|
|
12658
|
+
const { type: L } = B.data;
|
|
12659
|
+
if (L === "init_success")
|
|
12656
12660
|
r.isSAMReady = !0, i.emit("initialized"), t && v();
|
|
12657
|
-
else if (
|
|
12658
|
-
const { viewportVersion:
|
|
12659
|
-
|
|
12660
|
-
} else if (
|
|
12661
|
+
else if (L === "encode_success") {
|
|
12662
|
+
const { viewportVersion: k } = B.data;
|
|
12663
|
+
k < r.viewportVersion ? console.log("[a9s-sam] Stale encoding - discarding") : (i.emit("encodingFinished"), r.lastPointerPos && w(r.lastPointerPos));
|
|
12664
|
+
} else if (L === "decode_preview_success") {
|
|
12661
12665
|
if (r.sam && !r.isAnimationInProgress) {
|
|
12662
|
-
const { result:
|
|
12663
|
-
q === r.viewportVersion ? a.render(
|
|
12666
|
+
const { result: k, viewportVersion: q } = B.data;
|
|
12667
|
+
q === r.viewportVersion ? a.render(k, r.sam.currentBounds) : console.log("[a9s-sam] Stale preview - discarding");
|
|
12664
12668
|
}
|
|
12665
|
-
} else if (
|
|
12669
|
+
} else if (L === "decode_success") {
|
|
12666
12670
|
if (a.clear(), r.sam) {
|
|
12667
|
-
const
|
|
12668
|
-
q.
|
|
12669
|
-
}
|
|
12670
|
-
} else if (
|
|
12671
|
-
const {
|
|
12672
|
-
|
|
12671
|
+
const k = Xe(B.data.result, r.sam, W.getUser(), e), { store: q } = W.state, J = q.getAnnotation(r.sam.currentAnnotationId);
|
|
12672
|
+
J ? (q.updateAnnotation(r.sam.currentAnnotationId, k), i.emit("updateAnnotation", k, J, r.sam.currentPrompt)) : (q.addAnnotation(k), i.emit("createAnnotation", k, r.sam.currentPrompt));
|
|
12673
|
+
}
|
|
12674
|
+
} else if (L === "init_error") {
|
|
12675
|
+
const { error: k } = B.data;
|
|
12676
|
+
i.emit("initError", k);
|
|
12677
|
+
} else if (L === "encode_error") {
|
|
12678
|
+
const { viewportVersion: k } = B.data;
|
|
12679
|
+
k === r.viewportVersion && setTimeout(() => v(), 100);
|
|
12673
12680
|
}
|
|
12674
|
-
},
|
|
12675
|
-
destroy:
|
|
12676
|
-
reset:
|
|
12677
|
-
restart:
|
|
12678
|
-
setQueryMode:
|
|
12679
|
-
start:
|
|
12680
|
-
stop:
|
|
12681
|
-
on: (
|
|
12681
|
+
}, X.postMessage({ type: "init" }), {
|
|
12682
|
+
destroy: $,
|
|
12683
|
+
reset: Z,
|
|
12684
|
+
restart: j,
|
|
12685
|
+
setQueryMode: z,
|
|
12686
|
+
start: P,
|
|
12687
|
+
stop: V,
|
|
12688
|
+
on: (B, L) => i.on(B, L)
|
|
12682
12689
|
};
|
|
12683
12690
|
};
|
|
12684
12691
|
export {
|