@micrio/client 5.3.9 → 5.4.0
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/micrio.min.d.ts +65 -28
- package/micrio.min.js +3 -3
- package/package.json +1 -1
package/micrio.min.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare module '@micrio/client' {
|
|
|
4
4
|
* Defines the current version of the Micrio library.
|
|
5
5
|
* This constant is used internally and exposed statically via `HTMLMicrioElement.VERSION`.
|
|
6
6
|
*/
|
|
7
|
-
export const VERSION = "5.
|
|
7
|
+
export const VERSION = "5.4.0";
|
|
8
8
|
/**
|
|
9
9
|
* Loads an image texture asynchronously. Adds the request to the queue
|
|
10
10
|
* and returns a Promise that resolves with the TextureBitmap or rejects on error.
|
|
@@ -33,6 +33,7 @@ declare module '@micrio/client' {
|
|
|
33
33
|
* @returns Formatted time string (e.g., "1:23", "1:05:09", "-0:15").
|
|
34
34
|
*/
|
|
35
35
|
export function parseTime(s: number): string;
|
|
36
|
+
export const isLegacyViews: (i: Models.ImageInfo.ImageInfo) => boolean;
|
|
36
37
|
/**
|
|
37
38
|
* Decodes a character from a Micrio ID into its numeric value (used for V4 short IDs).
|
|
38
39
|
* @private
|
|
@@ -40,7 +41,7 @@ declare module '@micrio/client' {
|
|
|
40
41
|
export const getIdVal: (a: string) => number;
|
|
41
42
|
/** Checks if an ID likely belongs to the V5 format (6 or 7 characters). */
|
|
42
43
|
export const idIsV5: (id: string) => boolean;
|
|
43
|
-
/** Clamps a view rectangle
|
|
44
|
+
/** Clamps a view rectangle the image bounds [0, 0, 1, 1]. */
|
|
44
45
|
export const limitView: (v: Models.Camera.View) => Models.Camera.View;
|
|
45
46
|
/**
|
|
46
47
|
* Calculates the 3D vector and navigation parameters between two images in a 360 space.
|
|
@@ -63,6 +64,22 @@ declare module '@micrio/client' {
|
|
|
63
64
|
* @returns True if native HLS support is detected.
|
|
64
65
|
*/
|
|
65
66
|
export const hasNativeHLS: (video?: HTMLMediaElement) => boolean;
|
|
67
|
+
export const View: {
|
|
68
|
+
/** Casts a legacy view array ([x0, y0, x1, y1]) to [x0,y0,width,height]. */
|
|
69
|
+
fromLegacy: (v?: Models.Camera.ViewRect | Models.Camera.View) => Models.Camera.View | undefined;
|
|
70
|
+
toCenterJSON: (v: Models.Camera.View) => {
|
|
71
|
+
centerX: number;
|
|
72
|
+
centerY: number;
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
};
|
|
76
|
+
rectToCenterJSON: (v: Models.Camera.View) => {
|
|
77
|
+
centerX: number;
|
|
78
|
+
centerY: number;
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
66
83
|
/**
|
|
67
84
|
* Defines various enums used throughout the Micrio application,
|
|
68
85
|
* primarily for standardizing action types and option values.
|
|
@@ -120,25 +137,37 @@ declare module '@micrio/client' {
|
|
|
120
137
|
export class Camera {
|
|
121
138
|
/** Current center screen coordinates [x, y] and scale [z]. For 360, also includes [yaw, pitch]. For Omni, also includes [frameIndex]. */
|
|
122
139
|
readonly center: Models.Camera.Coords;
|
|
140
|
+
/** CORRECT view: [x0, y0, width, height] */
|
|
141
|
+
private readonly view;
|
|
142
|
+
/**
|
|
143
|
+
* Gets the current image view rectangle.
|
|
144
|
+
* @returns A copy of the current screen viewport array, or undefined if not initialized.
|
|
145
|
+
*/
|
|
146
|
+
getView: () => Models.Camera.View;
|
|
147
|
+
/**
|
|
148
|
+
* Gets the current image view rectangle [centerX, centerY, width, height] relative to the image (0-1).
|
|
149
|
+
* @returns A copy of the current screen viewport array, or undefined if not initialized.
|
|
150
|
+
*/
|
|
151
|
+
getViewRaw: () => Float64Array;
|
|
123
152
|
/**
|
|
124
153
|
* Gets the current image view rectangle [x0, y0, x1, y1] relative to the image (0-1).
|
|
125
154
|
* @returns A copy of the current screen viewport array, or undefined if not initialized.
|
|
126
155
|
*/
|
|
127
|
-
|
|
156
|
+
getViewLegacy: () => Models.Camera.ViewRect | undefined;
|
|
128
157
|
/**
|
|
129
|
-
* Sets the camera view instantly to the specified
|
|
130
|
-
* @param
|
|
158
|
+
* Sets the camera view instantly to the specified viewport.
|
|
159
|
+
* @param view The target viewport as either a View [x0, y0, x1, y1] or View {centerX, centerY, width, height}.
|
|
131
160
|
* @param opts Options for setting the view.
|
|
132
161
|
*/
|
|
133
|
-
setView(
|
|
162
|
+
setView(view: Models.Camera.View, opts?: {
|
|
134
163
|
/** If true, allows setting a view outside the normal image boundaries. */
|
|
135
164
|
noLimit?: boolean;
|
|
136
165
|
/** If true (for 360), corrects the view based on the `trueNorth` setting. */
|
|
137
166
|
correctNorth?: boolean;
|
|
138
167
|
/** If true, prevents triggering a Wasm render after setting the view. */
|
|
139
168
|
noRender?: boolean;
|
|
140
|
-
/** If provided, interprets `
|
|
141
|
-
area?: Models.Camera.
|
|
169
|
+
/** If provided, interprets `view` relative to this sub-area instead of the full image. */
|
|
170
|
+
area?: Models.Camera.ViewRect;
|
|
142
171
|
}): void;
|
|
143
172
|
/**
|
|
144
173
|
* Gets the relative image coordinates [x, y, scale, depth, yaw?, pitch?] corresponding to a screen coordinate.
|
|
@@ -185,7 +214,7 @@ declare module '@micrio/client' {
|
|
|
185
214
|
* @param scaleY Optional non-uniform Y scaling.
|
|
186
215
|
* @returns The resulting 4x4 matrix as a Float32Array.
|
|
187
216
|
*/
|
|
188
|
-
getMatrix(x: number, y: number, scale?: number, radius?: number, rotX?: number, rotY?: number, rotZ?: number, transY?: number, scaleX?: number, scaleY?: number): Float32Array;
|
|
217
|
+
getMatrix(x: number, y: number, scale?: number, radius?: number, rotX?: number, rotY?: number, rotZ?: number, transY?: number, scaleX?: number, scaleY?: number, noCorrectNorth?: boolean): Float32Array;
|
|
189
218
|
/**
|
|
190
219
|
* Sets the camera zoom scale instantly.
|
|
191
220
|
* @param s The target scale.
|
|
@@ -221,7 +250,7 @@ declare module '@micrio/client' {
|
|
|
221
250
|
* Sets a rectangular limit for camera navigation within the image.
|
|
222
251
|
* @param l The viewport limit rectangle [x0, y0, x1, y1].
|
|
223
252
|
*/
|
|
224
|
-
setLimit(
|
|
253
|
+
setLimit(v: Models.Camera.ViewRect): void;
|
|
225
254
|
/**
|
|
226
255
|
* Sets whether the camera view should be limited to always cover the viewport.
|
|
227
256
|
* @param b If true, limits the view to cover the screen.
|
|
@@ -236,12 +265,12 @@ declare module '@micrio/client' {
|
|
|
236
265
|
*/
|
|
237
266
|
set360RangeLimit(xPerc?: number, yPerc?: number): void;
|
|
238
267
|
/**
|
|
239
|
-
* Animates the camera smoothly to a target
|
|
240
|
-
* @param view The target viewport
|
|
268
|
+
* Animates the camera smoothly to a target viewport.
|
|
269
|
+
* @param view The target viewport as either a View [x0, y0, x1, y1] or View {centerX, centerY, width, height}.
|
|
241
270
|
* @param opts Optional animation settings.
|
|
242
271
|
* @returns A Promise that resolves when the animation completes, or rejects if aborted.
|
|
243
272
|
*/
|
|
244
|
-
flyToView: (view: Models.Camera.View, opts?: Models.Camera.AnimationOptions & {
|
|
273
|
+
flyToView: (view: Models.Camera.ViewRect | Models.Camera.View, opts?: Models.Camera.AnimationOptions & {
|
|
245
274
|
/** Set the starting animation progress percentage (0-1). */
|
|
246
275
|
progress?: number;
|
|
247
276
|
/** Base the progress override on this starting view. */
|
|
@@ -253,9 +282,11 @@ declare module '@micrio/client' {
|
|
|
253
282
|
/** If true (for 360), ignores the `trueNorth` correction. */
|
|
254
283
|
noTrueNorth?: boolean;
|
|
255
284
|
/** If provided, interprets `view` relative to this sub-area. */
|
|
256
|
-
area?: Models.Camera.
|
|
285
|
+
area?: Models.Camera.ViewRect;
|
|
257
286
|
/** If true, respects the image's maximum zoom limit during animation. */
|
|
258
287
|
limitZoom?: boolean;
|
|
288
|
+
/** If provided, adds a margin to the view. */
|
|
289
|
+
margin?: [number, number];
|
|
259
290
|
}) => Promise<void>;
|
|
260
291
|
/**
|
|
261
292
|
* Animates the camera to a view showing the entire image (minimum zoom).
|
|
@@ -343,7 +374,7 @@ declare module '@micrio/client' {
|
|
|
343
374
|
* @param v The target area rectangle [x0, y0, x1, y1] relative to the main canvas (0-1).
|
|
344
375
|
* @param opts Options for setting the area.
|
|
345
376
|
*/
|
|
346
|
-
setArea(v: Models.Camera.
|
|
377
|
+
setArea(v: Models.Camera.ViewRect, opts?: {
|
|
347
378
|
/** If true, sets the area instantly without animation. */
|
|
348
379
|
direct?: boolean;
|
|
349
380
|
/** If true, prevents dispatching view updates during the animation. */
|
|
@@ -549,7 +580,7 @@ declare module '@micrio/client' {
|
|
|
549
580
|
*/
|
|
550
581
|
class Image {
|
|
551
582
|
private image;
|
|
552
|
-
/** Writable Svelte store holding the current viewport [
|
|
583
|
+
/** Writable Svelte store holding the current viewport [centerX, centerY, width, height] of this image. */
|
|
553
584
|
readonly view: Writable<Models.Camera.View | undefined>;
|
|
554
585
|
/** Getter for the current value of the {@link view} store. */
|
|
555
586
|
get $view(): Models.Camera.View | undefined;
|
|
@@ -579,7 +610,7 @@ declare module '@micrio/client' {
|
|
|
579
610
|
private attr;
|
|
580
611
|
opts: {
|
|
581
612
|
/** Optional sub area [x0, y0, x1, y1] defining placement within a parent canvas (for embeds/galleries). */
|
|
582
|
-
area?: Models.Camera.
|
|
613
|
+
area?: Models.Camera.ViewRect;
|
|
583
614
|
/** For split screen, the primary image this one is secondary to. */
|
|
584
615
|
secondaryTo?: MicrioImage;
|
|
585
616
|
/** If true, passively follows the view changes of the primary split-screen image. */
|
|
@@ -628,7 +659,7 @@ declare module '@micrio/client' {
|
|
|
628
659
|
/** Stores an error message if loading failed. */
|
|
629
660
|
error: string | undefined;
|
|
630
661
|
/** Svelte Writable store holding the calculated pixel viewport [left, top, width, height] of this image within the main canvas. */
|
|
631
|
-
readonly viewport: Writable<Models.Camera.
|
|
662
|
+
readonly viewport: Writable<Models.Camera.ViewRect>;
|
|
632
663
|
/** Array of child {@link MicrioImage} instances embedded within this image. */
|
|
633
664
|
readonly embeds: MicrioImage[];
|
|
634
665
|
/** Grid controller instance, if this image is a grid container. */
|
|
@@ -642,7 +673,7 @@ declare module '@micrio/client' {
|
|
|
642
673
|
* @param opts Embedding options (opacity, fit, etc.).
|
|
643
674
|
* @returns The newly created embedded {@link MicrioImage} instance.
|
|
644
675
|
*/
|
|
645
|
-
addEmbed(info: Partial<Models.ImageInfo.ImageInfo>, area: Models.Camera.
|
|
676
|
+
addEmbed(info: Partial<Models.ImageInfo.ImageInfo>, area: Models.Camera.ViewRect, opts?: Models.Embeds.EmbedOptions): MicrioImage;
|
|
646
677
|
/** Gets the HTMLMediaElement associated with a video embed ID. */
|
|
647
678
|
getEmbedMediaElement(id: string): HTMLMediaElement | undefined;
|
|
648
679
|
/** Fades in the image smoothly or instantly. */
|
|
@@ -793,7 +824,7 @@ declare module '@micrio/client' {
|
|
|
793
824
|
*/
|
|
794
825
|
enlarge(idx: number, width: number, height?: number): Promise<MicrioImage[]>;
|
|
795
826
|
/** Get the relative in-grid viewport of the image */
|
|
796
|
-
getRelativeView(image: MicrioImage, view: Models.Camera.
|
|
827
|
+
getRelativeView(image: MicrioImage, view: Models.Camera.ViewRect): Models.Camera.ViewRect;
|
|
797
828
|
}
|
|
798
829
|
/**
|
|
799
830
|
* Video tour controller. Manages playback and camera animation for video tours
|
|
@@ -905,9 +936,11 @@ declare module '@micrio/client' {
|
|
|
905
936
|
/** The Micrio version this image was created in
|
|
906
937
|
* @default autoloaded
|
|
907
938
|
*/
|
|
908
|
-
version:
|
|
939
|
+
version: string;
|
|
909
940
|
/** Created date */
|
|
910
941
|
created?: number;
|
|
942
|
+
/** Has new viewport model, optimized for 360 images */
|
|
943
|
+
viewsWH?: boolean;
|
|
911
944
|
/** For V5+: published revisions per language */
|
|
912
945
|
revision?: RevisionType;
|
|
913
946
|
/** The original image width
|
|
@@ -973,7 +1006,7 @@ declare module '@micrio/client' {
|
|
|
973
1006
|
}
|
|
974
1007
|
/** Micrio image settings, which is on load included as {@link ImageInfo}`.settings`. */
|
|
975
1008
|
type Settings = {
|
|
976
|
-
/** The starting viewport
|
|
1009
|
+
/** The starting viewport */
|
|
977
1010
|
view?: Camera.View;
|
|
978
1011
|
/** Restrict navigation to this viewport (`[x0,y0,x1,y1]`) */
|
|
979
1012
|
restrict?: Camera.View;
|
|
@@ -1635,6 +1668,8 @@ declare module '@micrio/client' {
|
|
|
1635
1668
|
keepMarkers?: boolean;
|
|
1636
1669
|
/** Don't disable user navigation when running */
|
|
1637
1670
|
keepInteraction?: boolean;
|
|
1671
|
+
/** The tour is a direct outside instance using legacy [x0,y0,x1,y1] viewports */
|
|
1672
|
+
isLegacy?: boolean;
|
|
1638
1673
|
/** Current running tour instance */
|
|
1639
1674
|
instance?: VideoTourInstance;
|
|
1640
1675
|
};
|
|
@@ -1901,7 +1936,7 @@ declare module '@micrio/client' {
|
|
|
1901
1936
|
baseTileIdx: number;
|
|
1902
1937
|
ptr: number;
|
|
1903
1938
|
opts: {
|
|
1904
|
-
area: Camera.
|
|
1939
|
+
area: Camera.ViewRect;
|
|
1905
1940
|
};
|
|
1906
1941
|
}
|
|
1907
1942
|
}
|
|
@@ -1912,8 +1947,8 @@ declare module '@micrio/client' {
|
|
|
1912
1947
|
/** Virtual ImageInfo extension to support grid logic */
|
|
1913
1948
|
interface GridImage extends Partial<ImageInfo.ImageInfo> {
|
|
1914
1949
|
size: [number, number?];
|
|
1915
|
-
area?: Camera.
|
|
1916
|
-
view?: Camera.
|
|
1950
|
+
area?: Camera.ViewRect;
|
|
1951
|
+
view?: Camera.ViewRect;
|
|
1917
1952
|
}
|
|
1918
1953
|
interface GridHistory {
|
|
1919
1954
|
layout: string;
|
|
@@ -1922,7 +1957,7 @@ declare module '@micrio/client' {
|
|
|
1922
1957
|
}
|
|
1923
1958
|
interface GridImageOptions {
|
|
1924
1959
|
view?: Camera.View;
|
|
1925
|
-
area?: Camera.
|
|
1960
|
+
area?: Camera.ViewRect;
|
|
1926
1961
|
size?: number[];
|
|
1927
1962
|
}
|
|
1928
1963
|
interface FocusOptions {
|
|
@@ -1984,7 +2019,9 @@ declare module '@micrio/client' {
|
|
|
1984
2019
|
hooked?: boolean;
|
|
1985
2020
|
}
|
|
1986
2021
|
namespace Camera {
|
|
1987
|
-
/** A viewport rectangle */
|
|
2022
|
+
/** A viewport rectangle [x0,y0,x1,y1] */
|
|
2023
|
+
type ViewRect = number[] | Float64Array;
|
|
2024
|
+
/** An area definition [x0,y0,width,height] */
|
|
1988
2025
|
type View = number[] | Float64Array;
|
|
1989
2026
|
/** Coordinate tuple, [x, y, scale] */
|
|
1990
2027
|
type Coords = [number, number, number?] | Float64Array;
|
|
@@ -2519,7 +2556,7 @@ declare module '@micrio/client' {
|
|
|
2519
2556
|
splitTo?: MicrioImage;
|
|
2520
2557
|
/** If true, opens the split-screen view passively (doesn't take focus). */
|
|
2521
2558
|
isPassive?: boolean;
|
|
2522
|
-
/** An optional starting view
|
|
2559
|
+
/** An optional starting view to apply immediately. */
|
|
2523
2560
|
startView?: Models.Camera.View;
|
|
2524
2561
|
/** For 360 transitions, provides the direction vector from the previous image. */
|
|
2525
2562
|
vector?: Models.Camera.Vector;
|