med-viewer-sdk 0.1.7 → 0.1.9
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/core/Engine.d.ts +5 -7
- package/dist/med-viewer-sdk.d.ts +8 -8
- package/dist/med-viewer-sdk.mjs +20 -21
- package/dist/med-viewer-sdk.umd.js +1 -1
- package/package.json +1 -1
- package/src/adapters/vue/MedViewer.ts +3 -2
- package/src/core/Engine.ts +56 -71
- package/src/index.ts +36 -11
- package/src/types/type.d.ts +1 -1
package/dist/core/Engine.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import OpenSeadragon from "openseadragon";
|
|
2
|
+
import type OpenSeadragonType from "openseadragon";
|
|
2
3
|
import { AnnoAnnotator } from "./AnnoAnnotator";
|
|
3
4
|
import { MedToolbar, type ToolbarOptions } from "./Toolbar";
|
|
4
5
|
import { ColorAdjustPlugin, type ColorAdjustOptions } from "./ColorAdjustPlugin";
|
|
5
|
-
import { SelectionPlugin, type SelectionOptions } from
|
|
6
|
-
import { ScalebarPlugin, type ScalebarOptions } from
|
|
7
|
-
import { MagnificationPlugin, type MagnificationOptions } from
|
|
6
|
+
import { SelectionPlugin, type SelectionOptions } from "./SelectionPlugin";
|
|
7
|
+
import { ScalebarPlugin, type ScalebarOptions } from "./Scalebar";
|
|
8
|
+
import { MagnificationPlugin, type MagnificationOptions } from "./Magnification";
|
|
8
9
|
import { Locale } from "./i18n";
|
|
9
10
|
/**
|
|
10
11
|
* 引擎配置接口
|
|
11
12
|
*/
|
|
12
13
|
export interface MedEngineOptions {
|
|
13
|
-
|
|
14
|
-
tileSource: string | any;
|
|
15
|
-
navigatorBorderRadius?: number;
|
|
16
|
-
prefixUrl?: string;
|
|
14
|
+
osdOptions: OpenSeadragonType.Options;
|
|
17
15
|
locale?: Locale;
|
|
18
16
|
plugins?: {
|
|
19
17
|
annotorious?: boolean | any;
|
package/dist/med-viewer-sdk.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MedViewerEngine, type MedEngineOptions } from
|
|
2
|
-
import { type ScalebarOptions } from
|
|
3
|
-
import { AnnoAnnotator } from
|
|
4
|
-
import { MedToolbar, type ToolbarOptions } from
|
|
5
|
-
import { SelectionPlugin, type SelectionOptions } from
|
|
6
|
-
import { ColorAdjustPlugin, type ColorAdjustOptions } from
|
|
7
|
-
import { MagnificationPlugin, type MagnificationOptions } from
|
|
8
|
-
export { MedViewerEngine, type MedEngineOptions, AnnoAnnotator, MedToolbar, type ToolbarOptions, SelectionPlugin, type SelectionOptions, ColorAdjustPlugin, type ColorAdjustOptions, MagnificationPlugin, type MagnificationOptions, type ScalebarOptions };
|
|
1
|
+
import { MedViewerEngine, type MedEngineOptions } from "./core/Engine";
|
|
2
|
+
import { type ScalebarOptions, ScalebarType, ScalebarLocation } from "./core/Scalebar";
|
|
3
|
+
import { AnnoAnnotator } from "./core/AnnoAnnotator";
|
|
4
|
+
import { MedToolbar, type ToolbarOptions } from "./core/Toolbar";
|
|
5
|
+
import { SelectionPlugin, type SelectionOptions } from "./core/SelectionPlugin";
|
|
6
|
+
import { ColorAdjustPlugin, type ColorAdjustOptions } from "./core/ColorAdjustPlugin";
|
|
7
|
+
import { MagnificationPlugin, type MagnificationOptions } from "./core/Magnification";
|
|
8
|
+
export { MedViewerEngine, type MedEngineOptions, AnnoAnnotator, MedToolbar, type ToolbarOptions, SelectionPlugin, type SelectionOptions, ColorAdjustPlugin, type ColorAdjustOptions, MagnificationPlugin, type MagnificationOptions, type ScalebarOptions, ScalebarType, ScalebarLocation, };
|
package/dist/med-viewer-sdk.mjs
CHANGED
|
@@ -15152,16 +15152,17 @@ class MedViewerEngine {
|
|
|
15152
15152
|
__publicField(this, "scalebar", null);
|
|
15153
15153
|
__publicField(this, "magnification", null);
|
|
15154
15154
|
__publicField(this, "options");
|
|
15155
|
+
var _a;
|
|
15156
|
+
if (!options.osdOptions) {
|
|
15157
|
+
throw new Error("osdOptions is required");
|
|
15158
|
+
}
|
|
15155
15159
|
if (options.locale) {
|
|
15156
15160
|
setLocale(options.locale);
|
|
15157
15161
|
}
|
|
15158
|
-
const
|
|
15162
|
+
const osdOptions = {
|
|
15159
15163
|
id: "osd-container",
|
|
15160
15164
|
crossOriginPolicy: "Anonymous",
|
|
15161
|
-
prefixUrl: options.prefixUrl || "",
|
|
15162
|
-
// --- Viewer 基础 ---
|
|
15163
|
-
//useCanvas: true, // Canvas 渲染更稳定 //已经弃用了
|
|
15164
|
-
// drawer: [ "webgl","canvas"],
|
|
15165
|
+
prefixUrl: ((_a = options.osdOptions) == null ? void 0 : _a.prefixUrl) || "",
|
|
15165
15166
|
opacity: 1,
|
|
15166
15167
|
preload: false,
|
|
15167
15168
|
immediateRender: false,
|
|
@@ -15211,27 +15212,22 @@ class MedViewerEngine {
|
|
|
15211
15212
|
gestureSettingsMouse: {
|
|
15212
15213
|
dragToPan: true,
|
|
15213
15214
|
clickToZoom: false,
|
|
15214
|
-
dblClickToZoom: false
|
|
15215
|
-
contextMenu: true
|
|
15215
|
+
dblClickToZoom: false
|
|
15216
15216
|
},
|
|
15217
15217
|
gestureSettingsTouch: {
|
|
15218
15218
|
flickEnabled: false,
|
|
15219
|
-
pinchToZoom: true
|
|
15220
|
-
panToNextImage: false,
|
|
15221
|
-
contextMenu: true
|
|
15219
|
+
pinchToZoom: true
|
|
15222
15220
|
},
|
|
15223
|
-
|
|
15224
|
-
annotorious: false,
|
|
15225
|
-
toolbar: false,
|
|
15226
|
-
selection: false
|
|
15227
|
-
},
|
|
15228
|
-
...options
|
|
15221
|
+
...options.osdOptions
|
|
15229
15222
|
};
|
|
15230
|
-
|
|
15231
|
-
this.
|
|
15223
|
+
options.osdOptions = osdOptions;
|
|
15224
|
+
this.options = options;
|
|
15225
|
+
this.viewer = OpenSeadragon(osdOptions);
|
|
15232
15226
|
this.viewer.addOnceHandler("tile-loaded", () => {
|
|
15233
15227
|
this.viewer.viewport.goHome();
|
|
15234
|
-
console.log(
|
|
15228
|
+
console.log(
|
|
15229
|
+
"[MedViewerEngine] First tile loaded, refreshing viewer layout."
|
|
15230
|
+
);
|
|
15235
15231
|
});
|
|
15236
15232
|
this.initPlugins();
|
|
15237
15233
|
}
|
|
@@ -15288,7 +15284,9 @@ class MedViewerEngine {
|
|
|
15288
15284
|
mountAnnotorious(config) {
|
|
15289
15285
|
try {
|
|
15290
15286
|
this.anno = new AnnoAnnotator(this, config);
|
|
15291
|
-
console.log(
|
|
15287
|
+
console.log(
|
|
15288
|
+
"[MedEngine] Annotorious plugin initialized. version: 2.7.17"
|
|
15289
|
+
);
|
|
15292
15290
|
} catch (error) {
|
|
15293
15291
|
console.error("[MedEngine] Failed to initialize Annotorious:", error);
|
|
15294
15292
|
}
|
|
@@ -15304,7 +15302,6 @@ class MedViewerEngine {
|
|
|
15304
15302
|
(_d = this.scalebar) == null ? void 0 : _d.destroy();
|
|
15305
15303
|
(_e = this.colorAdjust) == null ? void 0 : _e.destroy();
|
|
15306
15304
|
this.viewer.destroy();
|
|
15307
|
-
this.options.element.innerHTML = "";
|
|
15308
15305
|
}
|
|
15309
15306
|
}
|
|
15310
15307
|
if (typeof window !== "undefined") {
|
|
@@ -15323,5 +15320,7 @@ export {
|
|
|
15323
15320
|
MagnificationPlugin,
|
|
15324
15321
|
MedToolbar,
|
|
15325
15322
|
MedViewerEngine,
|
|
15323
|
+
ScalebarLocation,
|
|
15324
|
+
ScalebarType,
|
|
15326
15325
|
SelectionPlugin
|
|
15327
15326
|
};
|