med-viewer-sdk 0.1.16 → 0.1.19
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/med-viewer-sdk.mjs
CHANGED
|
@@ -14117,9 +14117,7 @@ class MagnificationPlugin {
|
|
|
14117
14117
|
const tiledImage = this.viewer.world.getItemAt(0);
|
|
14118
14118
|
if (!this.magnificationDisplay || !tiledImage)
|
|
14119
14119
|
return;
|
|
14120
|
-
const currentZoom = this.viewer.viewport.viewportToImageZoom(
|
|
14121
|
-
this.viewer.viewport.getZoom()
|
|
14122
|
-
);
|
|
14120
|
+
const currentZoom = this.viewer.viewport.viewportToImageZoom(this.viewer.viewport.getZoom());
|
|
14123
14121
|
const baseMag = ((_b2 = this.viewer.source) == null ? void 0 : _b2.max_magnification) || 40;
|
|
14124
14122
|
const magnification = currentZoom * baseMag;
|
|
14125
14123
|
this.magnificationDisplay.innerHTML = `<span>${magnification.toFixed(2)}X</span>`;
|
|
@@ -14142,10 +14140,7 @@ class MagnificationPlugin {
|
|
|
14142
14140
|
this.magnificationElement.appendChild(buttonsContainer);
|
|
14143
14141
|
const magnifications = [40, 20, 10, 4];
|
|
14144
14142
|
magnifications.forEach((mag) => {
|
|
14145
|
-
const btn = this.createButton(
|
|
14146
|
-
`${mag}X`,
|
|
14147
|
-
() => this.setMagnification(mag)
|
|
14148
|
-
);
|
|
14143
|
+
const btn = this.createButton(`${mag}X`, () => this.setMagnification(mag));
|
|
14149
14144
|
buttonsContainer.appendChild(btn);
|
|
14150
14145
|
});
|
|
14151
14146
|
const fitBtn = this.createButton("Fit", () => this.fitToScreen());
|
|
@@ -14176,14 +14171,12 @@ class MagnificationPlugin {
|
|
|
14176
14171
|
const conversionFactor = 20 * 11e-4 * pixelsPerMeter / width;
|
|
14177
14172
|
return conversionFactor * currentZoom2;
|
|
14178
14173
|
}
|
|
14179
|
-
const currentZoom = this.viewer.viewport.viewportToImageZoom(
|
|
14180
|
-
this.viewer.viewport.getZoom()
|
|
14181
|
-
);
|
|
14174
|
+
const currentZoom = this.viewer.viewport.viewportToImageZoom(this.viewer.viewport.getZoom());
|
|
14182
14175
|
const baseMag = ((_b2 = this.viewer.source) == null ? void 0 : _b2.max_magnification) || 40;
|
|
14183
14176
|
return currentZoom * baseMag;
|
|
14184
14177
|
}
|
|
14185
14178
|
// 修改 setMagnification 方法
|
|
14186
|
-
setMagnification(mag) {
|
|
14179
|
+
async setMagnification(mag) {
|
|
14187
14180
|
var _a2, _b2;
|
|
14188
14181
|
if (this.options.type === "LD") {
|
|
14189
14182
|
const tiledImage = this.viewer.world.getItemAt(0);
|
|
@@ -14196,11 +14189,7 @@ class MagnificationPlugin {
|
|
|
14196
14189
|
this.viewer.viewport.getZoom();
|
|
14197
14190
|
const conversionFactor = 20 * 11e-4 * pixelsPerMeter / width;
|
|
14198
14191
|
const targetZoom = mag / conversionFactor;
|
|
14199
|
-
this.viewer.viewport.zoomTo(
|
|
14200
|
-
targetZoom,
|
|
14201
|
-
this.viewer.viewport.getCenter(),
|
|
14202
|
-
false
|
|
14203
|
-
);
|
|
14192
|
+
await this.viewer.viewport.zoomTo(targetZoom, this.viewer.viewport.getCenter(), false);
|
|
14204
14193
|
this.updateMagnificationDisplay();
|
|
14205
14194
|
} else {
|
|
14206
14195
|
const tiledImage = this.viewer.world.getItemAt(0);
|
|
@@ -14209,11 +14198,8 @@ class MagnificationPlugin {
|
|
|
14209
14198
|
const baseMag = ((_b2 = this.viewer.source) == null ? void 0 : _b2.max_magnification) || 40;
|
|
14210
14199
|
const targetImageZoom = mag / baseMag;
|
|
14211
14200
|
const targetViewportZoom = this.viewer.viewport.imageToViewportZoom(targetImageZoom);
|
|
14212
|
-
this.viewer.viewport.zoomTo(
|
|
14213
|
-
|
|
14214
|
-
this.viewer.viewport.getCenter(),
|
|
14215
|
-
false
|
|
14216
|
-
);
|
|
14201
|
+
await this.viewer.viewport.zoomTo(targetViewportZoom, this.viewer.viewport.getCenter(), false);
|
|
14202
|
+
this.updateMagnificationDisplay();
|
|
14217
14203
|
}
|
|
14218
14204
|
}
|
|
14219
14205
|
fitToScreen() {
|
|
@@ -14233,10 +14219,7 @@ class MagnificationPlugin {
|
|
|
14233
14219
|
this.magnificationDisplay = null;
|
|
14234
14220
|
}
|
|
14235
14221
|
this.viewer.removeHandler("animation", this.updateMagnificationDisplay);
|
|
14236
|
-
this.viewer.removeHandler(
|
|
14237
|
-
"animation-finish",
|
|
14238
|
-
this.updateMagnificationDisplay
|
|
14239
|
-
);
|
|
14222
|
+
this.viewer.removeHandler("animation-finish", this.updateMagnificationDisplay);
|
|
14240
14223
|
this.viewer.removeHandler("open", this.updateMagnificationDisplay);
|
|
14241
14224
|
this.viewer = null;
|
|
14242
14225
|
}
|