MCPcopy
hub / github.com/openseadragon/openseadragon / update

Function update

test/demo/m2/js/openseadragon-svg-overlay.js:10–28  ·  view source on GitHub ↗
(viewer)

Source from the content-addressed store, hash-verified

8 const svgNS = 'http://www.w3.org/2000/svg';
9
10 const update = function(viewer) {
11 const info = viewer._svgOverlayInfo;
12
13 if (info.containerWidth !== viewer.container.clientWidth) {
14 info.containerWidth = viewer.container.clientWidth;
15 info.svg.setAttribute('width', info.containerWidth);
16 }
17
18 if (info.containerHeight !== viewer.container.clientHeight) {
19 info.containerHeight = viewer.container.clientHeight;
20 info.svg.setAttribute('height', info.containerHeight);
21 }
22
23 const p = viewer.viewport.pixelFromPoint(new OpenSeadragon.Point(0, 0), true);
24 const zoom = viewer.viewport.getZoom(true);
25 const scale = viewer.container.clientWidth * zoom;
26 info.node.setAttribute('transform',
27 'translate(' + p.x + ',' + p.y + ') scale(' + scale + ')');
28 };
29
30 OpenSeadragon.Viewer.prototype.svgOverlay = function(command) {
31 const self = this;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…