pict-docuserve 0.1.2 → 0.1.4
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/pict-docuserve.js
CHANGED
|
@@ -6326,6 +6326,8 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
6326
6326
|
translateX: 0,
|
|
6327
6327
|
translateY: 0,
|
|
6328
6328
|
isPanning: false,
|
|
6329
|
+
didPan: false,
|
|
6330
|
+
currentKind: '',
|
|
6329
6331
|
panStartX: 0,
|
|
6330
6332
|
panStartY: 0,
|
|
6331
6333
|
panOrigX: 0,
|
|
@@ -6391,8 +6393,14 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
6391
6393
|
};
|
|
6392
6394
|
|
|
6393
6395
|
// Backdrop click closes (only when clicking the backdrop itself or
|
|
6394
|
-
// the stage area, not the inner content).
|
|
6396
|
+
// the stage area, not the inner content). Suppress if a
|
|
6397
|
+
// drag-to-pan just finished — the pointerup that ended the pan
|
|
6398
|
+
// also fires a click event which we must ignore.
|
|
6395
6399
|
tmpOverlay.addEventListener('click', pEvent => {
|
|
6400
|
+
if (tmpState.didPan) {
|
|
6401
|
+
tmpState.didPan = false;
|
|
6402
|
+
return;
|
|
6403
|
+
}
|
|
6396
6404
|
if (pEvent.target === tmpOverlay || pEvent.target === tmpStage) {
|
|
6397
6405
|
fClose();
|
|
6398
6406
|
}
|
|
@@ -6415,8 +6423,13 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
6415
6423
|
});
|
|
6416
6424
|
});
|
|
6417
6425
|
|
|
6418
|
-
// Wheel zoom
|
|
6426
|
+
// Wheel zoom — for images and mermaid diagrams.
|
|
6427
|
+
// For code blocks, let the browser handle native scrolling
|
|
6428
|
+
// so the user can scroll through long code.
|
|
6419
6429
|
tmpStage.addEventListener('wheel', pEvent => {
|
|
6430
|
+
if (tmpState.currentKind === 'code') {
|
|
6431
|
+
return;
|
|
6432
|
+
}
|
|
6420
6433
|
pEvent.preventDefault();
|
|
6421
6434
|
let tmpDelta = -pEvent.deltaY;
|
|
6422
6435
|
let tmpStep = (tmpDelta > 0 ? 1 : -1) * 0.15;
|
|
@@ -6425,8 +6438,11 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
6425
6438
|
passive: false
|
|
6426
6439
|
});
|
|
6427
6440
|
|
|
6428
|
-
// Drag-to-pan when zoomed
|
|
6441
|
+
// Drag-to-pan when zoomed (not for code blocks — they scroll natively)
|
|
6429
6442
|
tmpStage.addEventListener('pointerdown', pEvent => {
|
|
6443
|
+
if (tmpState.currentKind === 'code') {
|
|
6444
|
+
return;
|
|
6445
|
+
}
|
|
6430
6446
|
if (tmpState.scale <= 1.001) {
|
|
6431
6447
|
return;
|
|
6432
6448
|
}
|
|
@@ -6454,6 +6470,10 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
6454
6470
|
return;
|
|
6455
6471
|
}
|
|
6456
6472
|
tmpState.isPanning = false;
|
|
6473
|
+
// Flag that a pan just ended so the subsequent click event
|
|
6474
|
+
// (which the browser fires after pointerup) does not close
|
|
6475
|
+
// the overlay via the backdrop-close handler.
|
|
6476
|
+
tmpState.didPan = true;
|
|
6457
6477
|
tmpStage.classList.remove('is-panning');
|
|
6458
6478
|
try {
|
|
6459
6479
|
tmpStage.releasePointerCapture(pEvent.pointerId);
|
|
@@ -6513,6 +6533,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
6513
6533
|
tmpTitleEl.textContent = tmpTitle;
|
|
6514
6534
|
tmpContent.innerHTML = '';
|
|
6515
6535
|
let tmpKind = pSourceEl.getAttribute('data-fullscreen-source');
|
|
6536
|
+
tmpState.currentKind = tmpKind || '';
|
|
6516
6537
|
let tmpClone;
|
|
6517
6538
|
if (tmpKind === 'mermaid') {
|
|
6518
6539
|
let tmpSvg = pSourceEl.querySelector('svg');
|
|
@@ -6535,6 +6556,12 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
6535
6556
|
tmpClone.classList.add('pict-fullscreen-codewrap');
|
|
6536
6557
|
}
|
|
6537
6558
|
tmpContent.appendChild(tmpClone);
|
|
6559
|
+
|
|
6560
|
+
// Hide zoom controls for code blocks (they scroll natively)
|
|
6561
|
+
let tmpZoomBtns = tmpOverlay.querySelectorAll('[data-action="zoom-in"], [data-action="zoom-out"], [data-action="zoom-reset"]');
|
|
6562
|
+
for (let i = 0; i < tmpZoomBtns.length; i++) {
|
|
6563
|
+
tmpZoomBtns[i].style.display = tmpKind === 'code' ? 'none' : '';
|
|
6564
|
+
}
|
|
6538
6565
|
fResetTransform();
|
|
6539
6566
|
tmpOverlay.removeAttribute('hidden');
|
|
6540
6567
|
document.documentElement.style.overflow = 'hidden';
|