Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 137x 195x 780x 780x 780x 45x 180x 180x 180x 45x 135x 180x | /**
* Inline styles applied to an enabled viewport element so the browser does not
* consume touch input before cornerstone tools receive it, each paired with the
* data attribute used to remember the element's prior inline value.
*
* `touch-action: none` stops scrolling and pinch/double-tap zoom, but it does
* not cover text selection or the iOS text-magnifier loupe. Without the
* selection properties every hold-and-press interaction (Magnify,
* AdvancedMagnify's long-press zoom-factor picker) competes with the OS, and
* the threshold at which the OS wins is not predictable. `-webkit-user-select`
* is listed alongside the standard property because iOS Safari still requires
* the prefixed form.
*
* As with `touch-action`, none of these have behaviour worth preserving over a
* viewport: there is no text to select and no callout worth showing.
*/
const MANAGED_PROPERTIES = [
{ name: 'touch-action', attribute: 'data-prior-touch-action' },
{ name: 'user-select', attribute: 'data-prior-user-select' },
{ name: '-webkit-user-select', attribute: 'data-prior-webkit-user-select' },
{
name: '-webkit-touch-callout',
attribute: 'data-prior-webkit-touch-callout',
},
] as const;
/**
* Suppresses the browser's own touch handling on an enabled viewport element
* so gestures reach cornerstone tools intact. The prior inline value of each
* property is stored on the element so disable can restore it.
*
* Safe to call more than once: the stored values are only captured the first
* time, so a repeated call cannot overwrite them with the suppressed values.
*/
export function setElementTouchActionNone(element: HTMLDivElement): void {
MANAGED_PROPERTIES.forEach(({ name, attribute }) => {
Eif (!element.hasAttribute(attribute)) {
element.setAttribute(attribute, element.style.getPropertyValue(name));
}
element.style.setProperty(name, 'none');
});
}
/**
* Restores the inline values the element had before
* {@link setElementTouchActionNone}. No-op for elements that were never
* enabled, and for any property that was not previously set inline the
* declaration is removed rather than left as an empty string.
*/
export function restoreElementTouchAction(element: HTMLDivElement): void {
MANAGED_PROPERTIES.forEach(({ name, attribute }) => {
Iif (!element.hasAttribute(attribute)) {
return;
}
const priorValue = element.getAttribute(attribute);
if (priorValue) {
element.style.setProperty(name, priorValue);
} else {
element.style.removeProperty(name);
}
element.removeAttribute(attribute);
});
}
|