@micrio/client 5.1.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/README.md +31 -0
- package/micrio.min.d.ts +2416 -0
- package/micrio.min.js +9 -0
- package/package.json +18 -0
package/micrio.min.d.ts
ADDED
|
@@ -0,0 +1,2416 @@
|
|
|
1
|
+
declare module '@micrio/client' {
|
|
2
|
+
import type { Readable, Writable } from 'svelte/store';
|
|
3
|
+
export const VERSION = "5.1.0";
|
|
4
|
+
export type PREDEFINED = [string, Models.ImageInfo.ImageInfo, Models.ImageData.ImageData | undefined];
|
|
5
|
+
export const isFetching: (uri: string) => boolean;
|
|
6
|
+
export const getLocalData: (id: string) => PREDEFINED | undefined;
|
|
7
|
+
/** Get a character numeric value from a Micrio ID
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export const getIdVal: (a: string) => number;
|
|
11
|
+
export const idIsV5: (id: string) => boolean;
|
|
12
|
+
/** Hard-limit a view to full image bounds */
|
|
13
|
+
export const limitView: (v: Models.Camera.View) => Models.Camera.View;
|
|
14
|
+
/** Calculating the movement vector between two 360 images
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
export function getSpaceVector(micrio: HTMLMicrioElement, targetId: string): {
|
|
18
|
+
vector: Models.Camera.Vector;
|
|
19
|
+
directionX: number;
|
|
20
|
+
v: Models.Spaces.DirectionVector;
|
|
21
|
+
vN: Models.Spaces.DirectionVector;
|
|
22
|
+
} | undefined;
|
|
23
|
+
export namespace Enums {
|
|
24
|
+
namespace Grid {
|
|
25
|
+
/** External grid action types */
|
|
26
|
+
enum GridActionType {
|
|
27
|
+
/** Filter the grid display by these IDs, comma separated */
|
|
28
|
+
focus = 0,
|
|
29
|
+
/** Fly the camera to the bounding box of these in-grid image IDs */
|
|
30
|
+
flyTo = 1,
|
|
31
|
+
/** Filter the grid to the images containing markers that have this custom class name */
|
|
32
|
+
focusWithTagged = 2,
|
|
33
|
+
/** Filter the grid to the images containing markers that have this custom class name, and fly to their views */
|
|
34
|
+
focusTagged = 3,
|
|
35
|
+
/** Reset the grid to its inception state */
|
|
36
|
+
reset = 4,
|
|
37
|
+
/** Go back one grid history step */
|
|
38
|
+
back = 5,
|
|
39
|
+
/** When a grid image is in full-focus, immediately switch to the view as if it were in the initial grid */
|
|
40
|
+
switchToGrid = 6,
|
|
41
|
+
/** If there is a current MarkerTour going on, filter the grid to all grid images that are part of the tour */
|
|
42
|
+
filterTourImages = 7,
|
|
43
|
+
/** Single time fade duration for next image that will be navigated to */
|
|
44
|
+
nextFadeDuration = 8
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
namespace Camera {
|
|
48
|
+
/** Camera animation timing function */
|
|
49
|
+
enum TimingFunction {
|
|
50
|
+
'ease' = 0,
|
|
51
|
+
'ease-in' = 1,
|
|
52
|
+
'ease-out' = 2,
|
|
53
|
+
'linear' = 3
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Micrio grid display controller
|
|
59
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
60
|
+
* @copyright Q42 Internet BV, Micrio, 2015 - 2024
|
|
61
|
+
* @link https://micr.io/ , https://q42.nl/en/
|
|
62
|
+
*/
|
|
63
|
+
/** The Grid controller class */
|
|
64
|
+
export class Grid {
|
|
65
|
+
micrio: HTMLMicrioElement;
|
|
66
|
+
image: MicrioImage;
|
|
67
|
+
/** The instanced grid images */
|
|
68
|
+
readonly images: MicrioImage[];
|
|
69
|
+
/** The currently shown images */
|
|
70
|
+
current: MicrioImage[];
|
|
71
|
+
/** The grid HTML element */
|
|
72
|
+
_grid: HTMLDivElement;
|
|
73
|
+
/** The image HTML `<button>` grid elements */
|
|
74
|
+
_buttons: Map<string, HTMLButtonElement>;
|
|
75
|
+
/** The HTML grid will stay visible and clickable */
|
|
76
|
+
clickable: boolean;
|
|
77
|
+
/** The current full-view focussed image */
|
|
78
|
+
readonly focussed: Writable<MicrioImage | undefined>;
|
|
79
|
+
/** Get the current focussed store value */
|
|
80
|
+
get $focussed(): MicrioImage | undefined;
|
|
81
|
+
/** Show the markers of these elements */
|
|
82
|
+
readonly markersShown: Writable<MicrioImage[]>;
|
|
83
|
+
/** The grid state history */
|
|
84
|
+
history: Models.Grid.GridHistory[];
|
|
85
|
+
/** The current history length */
|
|
86
|
+
depth: Writable<number>;
|
|
87
|
+
/** The animation duration when opening a new layout, in s */
|
|
88
|
+
aniDurationIn: number;
|
|
89
|
+
/** The animation duration when going back, in s */
|
|
90
|
+
aniDurationOut: number;
|
|
91
|
+
/** For delayed transitions, individual delay in s */
|
|
92
|
+
transitionDelay: number;
|
|
93
|
+
/** Duration for the next crossfade */
|
|
94
|
+
private nextCrossFadeDuration;
|
|
95
|
+
/** The current grid layout is a single horizontal row */
|
|
96
|
+
private isHorizontal;
|
|
97
|
+
/** Current individual cell sizes w,h */
|
|
98
|
+
readonly cellSizes: Map<string, [number, number?]>;
|
|
99
|
+
/** Temporary size map for next .set() */
|
|
100
|
+
private readonly nextSize;
|
|
101
|
+
/** The Grid constructor
|
|
102
|
+
* @param micrio The Micrio instance
|
|
103
|
+
* @param image The MicrioImage which is the virtual grid container
|
|
104
|
+
*/
|
|
105
|
+
constructor(micrio: HTMLMicrioElement, image: MicrioImage);
|
|
106
|
+
/** Hook all events */
|
|
107
|
+
private hook;
|
|
108
|
+
private clearTimeouts;
|
|
109
|
+
/** Set the grid to this input
|
|
110
|
+
* @param input The grid string
|
|
111
|
+
* @param opts Optional settings
|
|
112
|
+
* @returns Promise when the animation is done with the currently shown images
|
|
113
|
+
*/
|
|
114
|
+
set(input?: string | MicrioImage[] | ({
|
|
115
|
+
image: MicrioImage;
|
|
116
|
+
} & Models.Grid.GridImageOptions)[], opts?: {
|
|
117
|
+
/** Don't add the layout to the history stack */
|
|
118
|
+
noHistory?: boolean;
|
|
119
|
+
/** Don't remove the grid HTML element */
|
|
120
|
+
keepGrid?: boolean;
|
|
121
|
+
/** The layout is horizontal */
|
|
122
|
+
horizontal?: boolean;
|
|
123
|
+
/** Any main camera animation duration in seconds */
|
|
124
|
+
duration?: number;
|
|
125
|
+
/** Fly the main grid view to this viewport */
|
|
126
|
+
view?: Models.Camera.View;
|
|
127
|
+
/** Don't draw any frame or do any camera stuff */
|
|
128
|
+
noCamAni?: boolean;
|
|
129
|
+
/** Force area animating for images currently not visible */
|
|
130
|
+
forceAreaAni?: boolean;
|
|
131
|
+
/** Don't unfocus the current focussed image */
|
|
132
|
+
noBlur?: boolean;
|
|
133
|
+
/** Don't do any fading in */
|
|
134
|
+
noFade?: boolean;
|
|
135
|
+
/** Transition animation, defaults to crossfade */
|
|
136
|
+
transition?: Models.Grid.GridSetTransition;
|
|
137
|
+
/** Force an animation for all images */
|
|
138
|
+
forceAni?: boolean;
|
|
139
|
+
/** Limit the images to cover view */
|
|
140
|
+
coverLimit?: boolean;
|
|
141
|
+
/** Open the images on cover view, but don't limit */
|
|
142
|
+
cover?: boolean;
|
|
143
|
+
/** Scale individual grid images (0-100%) */
|
|
144
|
+
scale?: number;
|
|
145
|
+
/** Grid columns */
|
|
146
|
+
columns?: number;
|
|
147
|
+
}): Promise<MicrioImage[]>;
|
|
148
|
+
/** See if grid has changed configuration from original state */
|
|
149
|
+
private hasChanged;
|
|
150
|
+
/** Convert a grid string to GridImage object
|
|
151
|
+
* @param s The image individual encoded grid string
|
|
152
|
+
* @returns the GridImage
|
|
153
|
+
*/
|
|
154
|
+
getImage(s: string): Models.Grid.GridImage;
|
|
155
|
+
/** Convert an ImageInfo object to an individual image grid string
|
|
156
|
+
* @returns The grid encoded string of this image
|
|
157
|
+
*/
|
|
158
|
+
getString: (i: Models.ImageInfo.ImageInfo, opts?: Models.Grid.GridImageOptions) => string;
|
|
159
|
+
private getCols;
|
|
160
|
+
/** Print the image grid based on a generated HTML layout
|
|
161
|
+
* @param images Print these images
|
|
162
|
+
* @param horizontal Print the images as a single row
|
|
163
|
+
*/
|
|
164
|
+
private printGrid;
|
|
165
|
+
/** Place and watch the grid */
|
|
166
|
+
private placeGrid;
|
|
167
|
+
/** Remove the grid */
|
|
168
|
+
private removeGrid;
|
|
169
|
+
/** Update grid placement */
|
|
170
|
+
private updateGrid;
|
|
171
|
+
/** Place an image in the grid
|
|
172
|
+
* @param entry The GridImage:MicrioInfo info object
|
|
173
|
+
* @param duration The duration of flying to an optional view
|
|
174
|
+
* @param noCamAni Just set internal values, don't animate camera
|
|
175
|
+
* @param delay Delay the animation, s
|
|
176
|
+
* @returns The instanced MicrioImage
|
|
177
|
+
*/
|
|
178
|
+
private placeImage;
|
|
179
|
+
/** Fade out unused images in the grid
|
|
180
|
+
* @param images The images to hide
|
|
181
|
+
*/
|
|
182
|
+
private removeImages;
|
|
183
|
+
/** Checks whether current viewed image is (part of) grid */
|
|
184
|
+
insideGrid(): boolean;
|
|
185
|
+
/** Reset the grid to its initial layout
|
|
186
|
+
* @param duration Duration in seconds
|
|
187
|
+
* @param noCamAni Don't do any camera animating
|
|
188
|
+
* @param forceAni Force animation on all grid images
|
|
189
|
+
* @returns Promise when the transition is complete
|
|
190
|
+
*/
|
|
191
|
+
reset(duration?: number, noCamAni?: boolean, forceAni?: boolean): Promise<MicrioImage[]>;
|
|
192
|
+
/** Fly to the viewports of any markers containing a class name
|
|
193
|
+
* @param tag The class name to match
|
|
194
|
+
* @param duration Optional duration in ms
|
|
195
|
+
* @param noZoom Don't zoom into the markers, just filter the images
|
|
196
|
+
* @returns Promise when the transition is complete
|
|
197
|
+
*/
|
|
198
|
+
flyToMarkers(tag?: string, duration?: number, noZoom?: boolean): Promise<MicrioImage[]>;
|
|
199
|
+
/** Go back one step in the grid history
|
|
200
|
+
* @param duration Optional duration for transition
|
|
201
|
+
* @returns Promise when the transition is complete
|
|
202
|
+
*/
|
|
203
|
+
back(duration?: number): Promise<void>;
|
|
204
|
+
private setTimingFunction;
|
|
205
|
+
/** Open a grid image full size and set it as the main active image
|
|
206
|
+
* @param img The image
|
|
207
|
+
* @param opts Focus options
|
|
208
|
+
* @returns Promise for when the transition completes
|
|
209
|
+
*/
|
|
210
|
+
focus(img: MicrioImage | undefined, opts?: Models.Grid.FocusOptions): Promise<void>;
|
|
211
|
+
private transition;
|
|
212
|
+
/** Unfocusses any currently focussed image */
|
|
213
|
+
blur(): void;
|
|
214
|
+
private tourEvent;
|
|
215
|
+
/** Do an (external) action
|
|
216
|
+
* @param action The action type enum or string
|
|
217
|
+
* @param data Optional action data
|
|
218
|
+
* @param duration Optional action duration
|
|
219
|
+
*/
|
|
220
|
+
action(action: Enums.Grid.GridActionType | string, data?: string, duration?: number): void;
|
|
221
|
+
/** Enlarge a specific image idx of the currently shown grid
|
|
222
|
+
* @param idx The image index of the current grid
|
|
223
|
+
* @param width The image target number of columns
|
|
224
|
+
* @param height The image target number of rows
|
|
225
|
+
* @returns Promise when the transition is completed
|
|
226
|
+
*/
|
|
227
|
+
enlarge(idx: number, width: number, height?: number): Promise<MicrioImage[]>;
|
|
228
|
+
/** Get the relative in-grid viewport of the image */
|
|
229
|
+
getRelativeView(image: MicrioImage, view: Models.Camera.View): Models.Camera.View;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The virtual Micrio camera
|
|
233
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
234
|
+
* @copyright Q42 Internet BV, Micrio, 2015 - 2024
|
|
235
|
+
* @link https://micr.io/ , https://q42.nl/en/
|
|
236
|
+
*/
|
|
237
|
+
export class Camera {
|
|
238
|
+
/** Current center screen coordinates and scale */
|
|
239
|
+
readonly center: Models.Camera.Coords;
|
|
240
|
+
/** Get the current image view rectangle
|
|
241
|
+
* @returns The current screen viewport
|
|
242
|
+
*/
|
|
243
|
+
getView: () => Models.Camera.View | undefined;
|
|
244
|
+
/** Set the screen viewport
|
|
245
|
+
* @param v The viewport
|
|
246
|
+
* @param opts Options
|
|
247
|
+
*/
|
|
248
|
+
setView(v: Models.Camera.View, opts?: {
|
|
249
|
+
/** Don't restrict the boundaries */
|
|
250
|
+
noLimit?: boolean;
|
|
251
|
+
/** [360] Correct the view to trueNorth */
|
|
252
|
+
correctNorth?: boolean;
|
|
253
|
+
/** Don't render */
|
|
254
|
+
noRender?: boolean;
|
|
255
|
+
/** Custom sub-area */
|
|
256
|
+
area?: Models.Camera.View;
|
|
257
|
+
}): void;
|
|
258
|
+
/** Gets the static image XY coordinates of a screen coordinate
|
|
259
|
+
* @param x The screen X coordinate in pixels
|
|
260
|
+
* @param y The screen Y coordinate in pixels
|
|
261
|
+
* @param absolute Use absolute browser window coordinates
|
|
262
|
+
* @param noLimit Allow to go out of image bounds
|
|
263
|
+
* @returns The relative image XY coordinates
|
|
264
|
+
*/
|
|
265
|
+
getCoo: (x: number, y: number, absolute?: boolean, noLimit?: boolean) => Float64Array;
|
|
266
|
+
/** Sets current coordinates as the center of the screen
|
|
267
|
+
* @param x The X Coordinate
|
|
268
|
+
* @param y The Y Coordinate
|
|
269
|
+
* @param scale The scale to set
|
|
270
|
+
*/
|
|
271
|
+
setCoo(x: number, y: number, scale?: number): void;
|
|
272
|
+
/** Gets the static screen XY coordinates of an image coordinate
|
|
273
|
+
* @param x The image X coordinate
|
|
274
|
+
* @param y The image Y coordinate
|
|
275
|
+
* @param abs Use absolute browser window coordinates
|
|
276
|
+
* @returns The screen XY coordinates in pixels
|
|
277
|
+
*/
|
|
278
|
+
getXY: (x: number, y: number, abs?: boolean, radius?: number, rotation?: number, noTrueNorth?: boolean) => Float64Array;
|
|
279
|
+
/** Get the current image scale */
|
|
280
|
+
getScale: () => number;
|
|
281
|
+
getQuad(cX: number, cY: number, w: number, h: number, rotX?: number, rotY?: number, rotZ?: number, scaleX?: number, scaleY?: number): Float32Array;
|
|
282
|
+
/** Get a custom matrix for 360 placed embeds
|
|
283
|
+
* @param x The X coordinate
|
|
284
|
+
* @param y The Y coordinate
|
|
285
|
+
* @param scale The object scale
|
|
286
|
+
* @param radius The object radius (default 10)
|
|
287
|
+
* @param rotX The object X rotation in radians
|
|
288
|
+
* @param rotY The object Y rotation in radians
|
|
289
|
+
* @param rotZ The object Z rotation in radians
|
|
290
|
+
* @param transY Optional Y translation in 3d space
|
|
291
|
+
* @returns The resulting 4x4 matrix
|
|
292
|
+
*/
|
|
293
|
+
getMatrix(x: number, y: number, scale?: number, radius?: number, rotX?: number, rotY?: number, rotZ?: number, transY?: number, scaleX?: number, scaleY?: number): Float32Array;
|
|
294
|
+
/** Set the current image scale
|
|
295
|
+
* @param s The scale
|
|
296
|
+
*/
|
|
297
|
+
setScale: (s: number) => void;
|
|
298
|
+
/** Get the scale when the image would cover the screen*/
|
|
299
|
+
getCoverScale: () => number;
|
|
300
|
+
/** Get the minimum scale
|
|
301
|
+
* @returns The minimum scale
|
|
302
|
+
*/
|
|
303
|
+
getMinScale: () => number;
|
|
304
|
+
/** Sets the minimum scale
|
|
305
|
+
* @param s The minimum scale to set
|
|
306
|
+
*/
|
|
307
|
+
setMinScale(s: number): void;
|
|
308
|
+
/** Sets the minimum screen size you can zoom out to -- this makes you able to zoom out with margins
|
|
309
|
+
* Note: This does not work with albums!
|
|
310
|
+
* @param s The minimum screen size [0-1]
|
|
311
|
+
*/
|
|
312
|
+
setMinScreenSize(s: number): void;
|
|
313
|
+
/** Returns true when the camera is zoomed in to the max */
|
|
314
|
+
isZoomedIn: () => boolean;
|
|
315
|
+
/** Returns true when the camera is fully zoomed out
|
|
316
|
+
* @param full When using a custom .minSize, use this in the calculation
|
|
317
|
+
*/
|
|
318
|
+
isZoomedOut: (full?: boolean) => boolean;
|
|
319
|
+
/** Limit camera navigation boundaries
|
|
320
|
+
* @param l The viewport limit
|
|
321
|
+
*/
|
|
322
|
+
setLimit(l: Models.Camera.View): void;
|
|
323
|
+
/** Set the coverLimit of the image to always fill the screen
|
|
324
|
+
* @param b Limit the image to cover view
|
|
325
|
+
*/
|
|
326
|
+
setCoverLimit(b: boolean): void;
|
|
327
|
+
/** Get whether the image always fills the screen or not */
|
|
328
|
+
getCoverLimit: () => boolean;
|
|
329
|
+
/** Limit camera navigation boundaries
|
|
330
|
+
* @param xPerc The horizontal arc to limit to, percentage (1 = 360°)
|
|
331
|
+
* @param yPerc The vertical arc to limit to, percentage (1 = 180°)
|
|
332
|
+
*/
|
|
333
|
+
set360RangeLimit(xPerc?: number, yPerc?: number): void;
|
|
334
|
+
/** Fly to a specific view
|
|
335
|
+
* @returns Promise when the animation is done
|
|
336
|
+
* @param view The viewport to fly to
|
|
337
|
+
* @param opts Optional animation settings
|
|
338
|
+
*/
|
|
339
|
+
flyToView: (view: Models.Camera.View, opts?: Models.Camera.AnimationOptions & {
|
|
340
|
+
/** Set the starting animation progress percentage */
|
|
341
|
+
progress?: number;
|
|
342
|
+
/** Base the progress override on this starting view */
|
|
343
|
+
prevView?: Models.Camera.View;
|
|
344
|
+
/** Zoom out and in during the animation */
|
|
345
|
+
isJump?: boolean;
|
|
346
|
+
/** For omni objects: image index to animate to */
|
|
347
|
+
omniIndex?: number;
|
|
348
|
+
/** Don't do trueNorth correction */
|
|
349
|
+
noTrueNorth?: boolean;
|
|
350
|
+
/** Custom sub-area */
|
|
351
|
+
area?: Models.Camera.View;
|
|
352
|
+
/** Respect the image's maximum zoom limit */
|
|
353
|
+
limitZoom?: boolean;
|
|
354
|
+
}) => Promise<void>;
|
|
355
|
+
/** Fly to a full view of the image
|
|
356
|
+
* @param opts Animation options
|
|
357
|
+
* @returns Promise when the animation is done
|
|
358
|
+
*/
|
|
359
|
+
flyToFullView: (opts?: Models.Camera.AnimationOptions) => Promise<void>;
|
|
360
|
+
/** Fly to a screen-covering view of the image
|
|
361
|
+
* @param opts Animation options
|
|
362
|
+
* @returns Promise when the animation is done
|
|
363
|
+
*/
|
|
364
|
+
flyToCoverView: (opts?: Models.Camera.AnimationOptions) => Promise<void>;
|
|
365
|
+
/** Fly to the specific coordinates
|
|
366
|
+
* @param coords The X, Y and scale coordinates to fly to
|
|
367
|
+
* @param opts Animation options
|
|
368
|
+
* @returns Promise when the animation is done
|
|
369
|
+
*/
|
|
370
|
+
flyToCoo: (coords: Models.Camera.Coords, opts?: Models.Camera.AnimationOptions) => Promise<void>;
|
|
371
|
+
/** Do a zooming animation
|
|
372
|
+
* @param delta The amount to zoom
|
|
373
|
+
* @param duration A forced duration in ms of the animation
|
|
374
|
+
* @param x Screen pixel X-coordinate as zoom focus
|
|
375
|
+
* @param y Screen pixel Y-coordinate as zoom focus
|
|
376
|
+
* @param speed A non-default camera speed
|
|
377
|
+
* @param noLimit Can zoom outside of the image boundaries
|
|
378
|
+
* @returns Promise when the zoom animation is done
|
|
379
|
+
*/
|
|
380
|
+
zoom: (delta: number, duration?: number, x?: number | undefined, y?: number | undefined, speed?: number, noLimit?: boolean) => Promise<void>;
|
|
381
|
+
/** Zoom out a factor
|
|
382
|
+
* @param factor The amount to zoom in
|
|
383
|
+
* @param duration A forced duration in ms of the animation
|
|
384
|
+
* @param speed A non-default camera speed
|
|
385
|
+
* @returns Promise when the zoom animation is done
|
|
386
|
+
*/
|
|
387
|
+
zoomIn: (factor?: number, duration?: number, speed?: number) => Promise<void>;
|
|
388
|
+
/** Zoom out a factor
|
|
389
|
+
* @param factor The amount to zoom out
|
|
390
|
+
* @param duration A forced duration in ms of the animation
|
|
391
|
+
* @param speed A non-default camera speed
|
|
392
|
+
* @returns Promise when the zoom animation is done
|
|
393
|
+
*/
|
|
394
|
+
zoomOut: (factor?: number, duration?: number, speed?: number) => Promise<void>;
|
|
395
|
+
/** Pan relative pixels
|
|
396
|
+
* @param x The horizontal number of pixels to pan
|
|
397
|
+
* @param y The vertical number of pixels to pan
|
|
398
|
+
* @param duration An optional duration
|
|
399
|
+
*/
|
|
400
|
+
pan(x: number, y: number, duration?: number, opts?: {
|
|
401
|
+
render?: boolean;
|
|
402
|
+
noLimit?: boolean;
|
|
403
|
+
}): void;
|
|
404
|
+
/** Stop any animation */
|
|
405
|
+
stop(): void;
|
|
406
|
+
/** Pause any animation */
|
|
407
|
+
pause(): void;
|
|
408
|
+
/** Pause any animation */
|
|
409
|
+
resume(): void;
|
|
410
|
+
/** Returns whether the current camera movement is kinetic / rubber banding */
|
|
411
|
+
aniIsKinetic(): boolean;
|
|
412
|
+
/** Get the current direction facing in 360 mode in radians */
|
|
413
|
+
getDirection: () => number;
|
|
414
|
+
/** Sets the 360 viewing direction in radians
|
|
415
|
+
* @param yaw The direction in radians
|
|
416
|
+
* @param pitch Optional pitch in radians
|
|
417
|
+
*/
|
|
418
|
+
setDirection(yaw: number, pitch?: number): void;
|
|
419
|
+
/** Get the current direction pitch
|
|
420
|
+
* @returns The current pitch in radians
|
|
421
|
+
*/
|
|
422
|
+
getPitch: () => number;
|
|
423
|
+
/** Set the relative {@link Models.Camera.View} to render to, animates by default */
|
|
424
|
+
setArea(v: Models.Camera.View, opts?: {
|
|
425
|
+
/** Directly set the area without animation */
|
|
426
|
+
direct?: boolean;
|
|
427
|
+
/** Don't emit the updates back to JS */
|
|
428
|
+
noDispatch?: boolean;
|
|
429
|
+
/** Don't trigger a frame draw */
|
|
430
|
+
noRender?: boolean;
|
|
431
|
+
}): void;
|
|
432
|
+
/** For in-image 360 embeds */
|
|
433
|
+
setRotation(rotX?: number, rotY?: number, rotZ?: number): void;
|
|
434
|
+
/** [Omni] Get the current rotation in degrees */
|
|
435
|
+
getOmniRotation(): number;
|
|
436
|
+
/** [Omni] Get the corresponding frame number to current rotation */
|
|
437
|
+
getOmniFrame(rot?: number): number | undefined;
|
|
438
|
+
getOmniXY(x: number, y: number, z: number): Float64Array;
|
|
439
|
+
setOmniSettings(): void;
|
|
440
|
+
}
|
|
441
|
+
export const BASEPATH_V5: string;
|
|
442
|
+
export const BASEPATH_V5_EU: string;
|
|
443
|
+
/** External wasm binary */
|
|
444
|
+
export const WASM: {
|
|
445
|
+
'b64': string;
|
|
446
|
+
'ugz'?: (b: string, t: boolean) => Promise<ArrayBuffer | Uint8Array>;
|
|
447
|
+
};
|
|
448
|
+
/** The WebAssembly class */
|
|
449
|
+
export class Wasm {
|
|
450
|
+
micrio: HTMLMicrioElement;
|
|
451
|
+
/** Wasm inited */
|
|
452
|
+
ready: boolean;
|
|
453
|
+
/** Shared WebAssembly memory -- 1 page is 64KB */
|
|
454
|
+
private memory;
|
|
455
|
+
/** The actual WebAssembly memory buffer -- only call here since memory won't grow */
|
|
456
|
+
private b;
|
|
457
|
+
/** The WebAssembly main instance memory pointer */
|
|
458
|
+
private i;
|
|
459
|
+
/** The WebAssembly current canvas instance memory pointer */
|
|
460
|
+
private c;
|
|
461
|
+
/** The current frame's timestamp */
|
|
462
|
+
private now;
|
|
463
|
+
/** RequestAnimationFrame pointer */
|
|
464
|
+
private raf;
|
|
465
|
+
/** Is currently drawing */
|
|
466
|
+
private drawing;
|
|
467
|
+
/** Barebone mode, minimal tile downloading */
|
|
468
|
+
private bareBone;
|
|
469
|
+
/** Number of tiles per image */
|
|
470
|
+
private baseTiles;
|
|
471
|
+
/** Array of tile indices drawn this frame */
|
|
472
|
+
private drawn;
|
|
473
|
+
/** Array of tile indices drawn last frame */
|
|
474
|
+
private prevDrawn;
|
|
475
|
+
/** Tile indices to be deleted */
|
|
476
|
+
private toDelete;
|
|
477
|
+
/** Tile textures */
|
|
478
|
+
private textures;
|
|
479
|
+
/** Running texture download threads */
|
|
480
|
+
private requests;
|
|
481
|
+
/** Timeout after texture loads */
|
|
482
|
+
private timeouts;
|
|
483
|
+
/** Tile loaded timestamp */
|
|
484
|
+
private tileLoaded;
|
|
485
|
+
/** Tile opacity */
|
|
486
|
+
private tileOpacity;
|
|
487
|
+
/** Tile load states */
|
|
488
|
+
private loadStates;
|
|
489
|
+
/** Svelte watch subscriptions */
|
|
490
|
+
private unsubscribe;
|
|
491
|
+
private cameras;
|
|
492
|
+
/** The tile vertex buffer */
|
|
493
|
+
_vertexBuffer: Float32Array;
|
|
494
|
+
/** The tile texture buffer */
|
|
495
|
+
static readonly _textureBuffer: Float32Array;
|
|
496
|
+
/** Number of X geometry segments per tile */
|
|
497
|
+
static segsX: number;
|
|
498
|
+
/** Number of Y geometry segments per tile */
|
|
499
|
+
static segsY: number;
|
|
500
|
+
/** The tile vertex buffer for 360 */
|
|
501
|
+
_vertexBuffer360: Float32Array;
|
|
502
|
+
/** The tile texture buffer for 360 */
|
|
503
|
+
static _textureBuffer360: Float32Array;
|
|
504
|
+
/** Camera perspective matrix from WebAssembly */
|
|
505
|
+
private _pMatrices;
|
|
506
|
+
/** Is paged */
|
|
507
|
+
private isGallery;
|
|
508
|
+
/** Wasm imports */
|
|
509
|
+
private imports;
|
|
510
|
+
/** Build the static tile texture coord buffer */
|
|
511
|
+
private static getTextureBuffer;
|
|
512
|
+
/** Create the WebAssembly instance
|
|
513
|
+
* @param micrio The main <micr-io> instance
|
|
514
|
+
*/
|
|
515
|
+
constructor(micrio: HTMLMicrioElement);
|
|
516
|
+
/** Load the WebAssembly module
|
|
517
|
+
* @returns The promise when loading is complete
|
|
518
|
+
*/
|
|
519
|
+
load(): Promise<void>;
|
|
520
|
+
/** Unbind this module */
|
|
521
|
+
unbind(): void;
|
|
522
|
+
/** Add a new rendering canvas */
|
|
523
|
+
private addCanvas;
|
|
524
|
+
/** Set the specified canvas as active
|
|
525
|
+
* @param canvas The Image to add
|
|
526
|
+
*/
|
|
527
|
+
setCanvas(canvas?: MicrioImage): void;
|
|
528
|
+
/** Remove a canvas */
|
|
529
|
+
removeCanvas(c: MicrioImage): void;
|
|
530
|
+
/** Request a next frame to draw */
|
|
531
|
+
render(): void;
|
|
532
|
+
/** Draw an actual frame */
|
|
533
|
+
private draw;
|
|
534
|
+
/** Cancel the current requestAnimationFrame request */
|
|
535
|
+
private stop;
|
|
536
|
+
/** Tile drawing function called from inside Wasm
|
|
537
|
+
* @returns True when the tile is downloaded and ready to drawn
|
|
538
|
+
*/
|
|
539
|
+
private drawTile;
|
|
540
|
+
/** Clear the canvas for drawing */
|
|
541
|
+
private drawStart;
|
|
542
|
+
/** Received the texture data */
|
|
543
|
+
private gotTexture;
|
|
544
|
+
/** Delete an ended or cancelled request */
|
|
545
|
+
private deleteRequest;
|
|
546
|
+
/** Delete a tile */
|
|
547
|
+
private deleteTile;
|
|
548
|
+
/** Do a general cleanup */
|
|
549
|
+
private cleanup;
|
|
550
|
+
/** Resize the internal canvas
|
|
551
|
+
* @param c The viewport rect
|
|
552
|
+
*/
|
|
553
|
+
resize(c: Models.Canvas.ViewRect): void;
|
|
554
|
+
/** Add a child image to the current canvas, either embed or independent canvas */
|
|
555
|
+
private addImage;
|
|
556
|
+
/** Add a child image to the current canvas
|
|
557
|
+
* @param image The image
|
|
558
|
+
* @param parent The parent image
|
|
559
|
+
* @param opts Embedding options
|
|
560
|
+
* @returns Promise when the image is added
|
|
561
|
+
*/
|
|
562
|
+
addEmbed: (image: MicrioImage | Models.Omni.Frame, parent: MicrioImage, opts?: Models.Embeds.EmbedOptions) => Promise<void>;
|
|
563
|
+
/** Add a child independent canvas to the current canvas, used for grid images
|
|
564
|
+
* @param image The image
|
|
565
|
+
* @param parent The parent image
|
|
566
|
+
* @returns Promise when the image is added
|
|
567
|
+
*/
|
|
568
|
+
addChild: (image: MicrioImage, parent: MicrioImage) => Promise<void>;
|
|
569
|
+
/** Simple image fader
|
|
570
|
+
* @param ptr The child image mem pointer
|
|
571
|
+
* @param opacity The target opacity
|
|
572
|
+
* @param direct Set immediately
|
|
573
|
+
*/
|
|
574
|
+
fadeImage(ptr: number, opacity: number, direct?: boolean): void;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Swipeable switching image sequence
|
|
578
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
579
|
+
* @copyright Q42 Internet BV, Micrio, 2015 - 2024
|
|
580
|
+
* @link https://micr.io/ , https://q42.nl/en/
|
|
581
|
+
*
|
|
582
|
+
*/
|
|
583
|
+
export class GallerySwiper {
|
|
584
|
+
private micrio;
|
|
585
|
+
private length;
|
|
586
|
+
goto: (i: number) => void;
|
|
587
|
+
private opts;
|
|
588
|
+
private startIndex;
|
|
589
|
+
private startX;
|
|
590
|
+
private hitTresh;
|
|
591
|
+
private snapTo;
|
|
592
|
+
private raf;
|
|
593
|
+
private pointers;
|
|
594
|
+
private isFullWidth;
|
|
595
|
+
private startedWithShift;
|
|
596
|
+
private firstTouchId;
|
|
597
|
+
private image;
|
|
598
|
+
get currentIndex(): number;
|
|
599
|
+
constructor(micrio: HTMLMicrioElement, length: number, goto: (i: number) => void, opts?: {
|
|
600
|
+
sensitivity?: number;
|
|
601
|
+
continuous?: boolean;
|
|
602
|
+
coverLimit?: boolean;
|
|
603
|
+
});
|
|
604
|
+
destroy(): void;
|
|
605
|
+
private isDragging;
|
|
606
|
+
/** Drag start */
|
|
607
|
+
private dStart;
|
|
608
|
+
/** Drag move */
|
|
609
|
+
private dMove;
|
|
610
|
+
/** Drag stop */
|
|
611
|
+
private dStop;
|
|
612
|
+
private mouseleave;
|
|
613
|
+
private swipeEnd;
|
|
614
|
+
/** Same as .goto(), but animate the rotation */
|
|
615
|
+
animateTo(idx: number): void;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* # Micrio State management
|
|
619
|
+
*
|
|
620
|
+
* Newly introduced in Micrio 4.0 is the replacement of the way you can interact with markers and tours from a classic imperative JavaScript API to a Svelte-inspired, store-based **state** management using {@link SvelteStore}.
|
|
621
|
+
*
|
|
622
|
+
* This has greatly simplified the internal workings and has made the HTML interface fully reactive based on the image state instead of being interwoven in the previous JS API itself.
|
|
623
|
+
*
|
|
624
|
+
* There are 2 `State` controllers:
|
|
625
|
+
*
|
|
626
|
+
* 1. {@link State.Main}: the main {@link HTMLMicrioElement} state controller, used for:
|
|
627
|
+
* * Getting and setting the active tour and marker
|
|
628
|
+
* * Loading and saving the entire current state as a minimal independent JSON object
|
|
629
|
+
* 2. {@link State.Image}: individual image {@link MicrioImage.state} controller, used for:
|
|
630
|
+
* * Setting the current opened marker in this image
|
|
631
|
+
* * Getting the image's last known viewport, even if it is not active at the moment
|
|
632
|
+
*
|
|
633
|
+
* ## Upgrading from Micrio 3.x to 4.x
|
|
634
|
+
*
|
|
635
|
+
* Please refer to [this Micrio knowledge base article](https://doc.micr.io/client/v4/migrating.html)
|
|
636
|
+
* for if you want to upgrade an existing 3.x implementation to 4.x.
|
|
637
|
+
*
|
|
638
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
639
|
+
* @copyright Q42 Internet BV, Micrio, 2015 - 2024
|
|
640
|
+
* @link https://micr.io/ , https://q42.nl/en/
|
|
641
|
+
*/
|
|
642
|
+
export namespace State {
|
|
643
|
+
/** A main Micrio state JSON object */
|
|
644
|
+
type MicrioStateJSON = {
|
|
645
|
+
/** The current image id */
|
|
646
|
+
id: string;
|
|
647
|
+
/** Array of individual image states */
|
|
648
|
+
c: ImageState[];
|
|
649
|
+
/** Any running tour */
|
|
650
|
+
t?: [string, number?, string?];
|
|
651
|
+
/** Any running media */
|
|
652
|
+
m?: HTMLMediaElement;
|
|
653
|
+
};
|
|
654
|
+
/** An individual image state */
|
|
655
|
+
type ImageState = [
|
|
656
|
+
string,
|
|
657
|
+
number,
|
|
658
|
+
number,
|
|
659
|
+
number,
|
|
660
|
+
number,
|
|
661
|
+
string?,
|
|
662
|
+
string?,
|
|
663
|
+
number?,
|
|
664
|
+
string?
|
|
665
|
+
];
|
|
666
|
+
/**
|
|
667
|
+
* # HTMLMicrioElement state controller
|
|
668
|
+
*
|
|
669
|
+
* The {@link State.Main} constructor is used as {@link HTMLMicrioElement.state}, and offers:
|
|
670
|
+
*
|
|
671
|
+
* * Reading and setting the active tour and marker
|
|
672
|
+
* * Loading and saving the entire current state as a minimal independent JSON object
|
|
673
|
+
*
|
|
674
|
+
*/
|
|
675
|
+
class Main {
|
|
676
|
+
private micrio;
|
|
677
|
+
/** The current {@link Models.ImageData.MarkerTour} or {@link Models.ImageData.VideoTour} store {@link SvelteStore.Writable} */
|
|
678
|
+
readonly tour: Writable<Models.ImageData.VideoTour | Models.ImageData.MarkerTour | undefined>;
|
|
679
|
+
/** The current active {@link Models.ImageData.MarkerTour} or {@link Models.ImageData.VideoTour} */
|
|
680
|
+
get $tour(): Models.ImageData.VideoTour | Models.ImageData.MarkerTour | undefined;
|
|
681
|
+
/** The current shown image's opened {@link Models.ImageData.Marker} store {@link SvelteStore.Writable} */
|
|
682
|
+
readonly marker: Writable<Models.ImageData.Marker | undefined>;
|
|
683
|
+
/** The current hovered marker */
|
|
684
|
+
readonly markerHoverId: Writable<string | undefined>;
|
|
685
|
+
/** The current opened {@link Models.ImageData.Marker} of the current shown {@link MicrioImage} */
|
|
686
|
+
get $marker(): Models.ImageData.Marker | undefined;
|
|
687
|
+
/** The current opened popup */
|
|
688
|
+
readonly popup: Writable<Models.ImageData.Marker | undefined>;
|
|
689
|
+
/** The current opened custom content page */
|
|
690
|
+
readonly popover: Writable<Models.State.PopoverType | undefined>;
|
|
691
|
+
/** UI controls settings */
|
|
692
|
+
ui: {
|
|
693
|
+
/** Show/hide main controls */
|
|
694
|
+
controls: Writable<boolean>;
|
|
695
|
+
/** Show zoom buttons if applicable */
|
|
696
|
+
zoom: Writable<boolean>;
|
|
697
|
+
/** Hide all UI elements */
|
|
698
|
+
hidden: Writable<boolean>;
|
|
699
|
+
};
|
|
700
|
+
/**
|
|
701
|
+
* Gets the current state as an independent, minimal JSON object.
|
|
702
|
+
* This includes the currently open image(s), marker(s), and actively playing media (video, audio, tour) and its state.
|
|
703
|
+
* You can use this object in any other environment to immediately replicate this state (neat!).
|
|
704
|
+
*
|
|
705
|
+
* Example:
|
|
706
|
+
*
|
|
707
|
+
* ```js
|
|
708
|
+
* // Save the current state in Browser 1
|
|
709
|
+
* const state = micrio.state.get();
|
|
710
|
+
*
|
|
711
|
+
* // Save or sync this object to Browser 2 and load it there..
|
|
712
|
+
*
|
|
713
|
+
* // This makes the <micr-io> session state identical to Browser 1.
|
|
714
|
+
* micrio.state.set(state);
|
|
715
|
+
* ```
|
|
716
|
+
*/
|
|
717
|
+
get(): MicrioStateJSON | undefined;
|
|
718
|
+
/**
|
|
719
|
+
* Sets the state from a `MicrioStateJSON` object, output by the function above here.
|
|
720
|
+
* This works on any Micrio instance!
|
|
721
|
+
*/
|
|
722
|
+
set(s: MicrioStateJSON): Promise<void>;
|
|
723
|
+
private setTour;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* # MicrioImage state controller
|
|
727
|
+
*
|
|
728
|
+
* The {@link State.Image} constructor is used as {@link MicrioImage.state}, and offers:
|
|
729
|
+
*
|
|
730
|
+
* * Setting the current opened marker in this image
|
|
731
|
+
* * Getting the image's last known viewport, even if it is not active at the moment
|
|
732
|
+
*/
|
|
733
|
+
class Image {
|
|
734
|
+
private image;
|
|
735
|
+
/** The current image viewport store {@link SvelteStore.Writable} */
|
|
736
|
+
readonly view: Writable<Models.Camera.View | undefined>;
|
|
737
|
+
/** The current or last known viewport of this image */
|
|
738
|
+
get $view(): Models.Camera.View | undefined;
|
|
739
|
+
/**
|
|
740
|
+
* The current active marker store {@link SvelteStore.Writable}.
|
|
741
|
+
* You can either set this to be a {@link Models.ImageData.Marker} JSON object, or `string`, which is the ID
|
|
742
|
+
* of the marker you wish to open.
|
|
743
|
+
*/
|
|
744
|
+
readonly marker: Writable<Models.ImageData.Marker | string | undefined>;
|
|
745
|
+
/** The current active Marker instance */
|
|
746
|
+
get $marker(): Models.ImageData.Marker | undefined;
|
|
747
|
+
/** The current layer to display (omni objects) */
|
|
748
|
+
readonly layer: Writable<number>;
|
|
749
|
+
/** Hook omni layer */
|
|
750
|
+
hookOmni(): void;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* An individual Micrio image
|
|
755
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
756
|
+
* @copyright Q42 Internet BV, Micrio, 2015 - 2024
|
|
757
|
+
* @link https://micr.io/ , https://q42.nl/en/
|
|
758
|
+
*/
|
|
759
|
+
export class MicrioImage {
|
|
760
|
+
wasm: Wasm;
|
|
761
|
+
private attr;
|
|
762
|
+
opts: {
|
|
763
|
+
/** Optional sub area for partial / embedded images */
|
|
764
|
+
area?: Models.Camera.View;
|
|
765
|
+
/** For split screen, the image this is secondary to */
|
|
766
|
+
secondaryTo?: MicrioImage;
|
|
767
|
+
/** Follow the movements of the main image */
|
|
768
|
+
isPassive?: boolean;
|
|
769
|
+
/** This is an in-image embed */
|
|
770
|
+
isEmbed?: boolean;
|
|
771
|
+
/** For non-independent embeds, use the parent's .camera */
|
|
772
|
+
useParentCamera?: boolean;
|
|
773
|
+
};
|
|
774
|
+
/** The image id */
|
|
775
|
+
readonly id: string;
|
|
776
|
+
/** Unique instance id */
|
|
777
|
+
readonly uuid: string;
|
|
778
|
+
/** The Micrio info data Readable store */
|
|
779
|
+
readonly info: Readable<Models.ImageInfo.ImageInfo | undefined>;
|
|
780
|
+
/** The image info data
|
|
781
|
+
* @readonly
|
|
782
|
+
*/
|
|
783
|
+
get $info(): Models.ImageInfo.ImageInfo | undefined;
|
|
784
|
+
/** The image settings Writable */
|
|
785
|
+
readonly settings: Writable<Models.ImageInfo.Settings>;
|
|
786
|
+
/** The current CultureData */
|
|
787
|
+
get $settings(): Models.ImageInfo.Settings;
|
|
788
|
+
/** The Micrio culture data Writable */
|
|
789
|
+
readonly data: Writable<Models.ImageData.ImageData | undefined>;
|
|
790
|
+
/** The current CultureData */
|
|
791
|
+
get $data(): Models.ImageData.ImageData | undefined;
|
|
792
|
+
/** State manager */
|
|
793
|
+
readonly state: State.Image;
|
|
794
|
+
/** The virtual camera instance to control the current main image views */
|
|
795
|
+
camera: Camera;
|
|
796
|
+
/** The 2D or 360 video MediaElement */
|
|
797
|
+
readonly video: Writable<HTMLVideoElement | undefined>;
|
|
798
|
+
/** The canvas is currently visible
|
|
799
|
+
* @readonly
|
|
800
|
+
*/
|
|
801
|
+
readonly visible: Writable<boolean>;
|
|
802
|
+
/** Album info if image is part of an album (V5+) */
|
|
803
|
+
album?: Models.Album | undefined;
|
|
804
|
+
/** Gallery swiper instance */
|
|
805
|
+
swiper: GallerySwiper | undefined;
|
|
806
|
+
/** The last opened view */
|
|
807
|
+
openedView: Models.Camera.View | undefined;
|
|
808
|
+
/** Error, if any */
|
|
809
|
+
error: string | undefined;
|
|
810
|
+
/** Rendered pixel rectangle [left, top, width, height] */
|
|
811
|
+
readonly viewport: Writable<Models.Camera.View>;
|
|
812
|
+
/** Embedded in-image children */
|
|
813
|
+
readonly embeds: MicrioImage[];
|
|
814
|
+
/** Grid controller */
|
|
815
|
+
grid: Grid | undefined;
|
|
816
|
+
/** The tile basePath */
|
|
817
|
+
tileBase: string | undefined;
|
|
818
|
+
private setError;
|
|
819
|
+
private loadScript;
|
|
820
|
+
private loadStyle;
|
|
821
|
+
/** Enrich marker tour data with external tour step info and durations
|
|
822
|
+
* This method is called BEFORE Image.data is set. So that's pretty neat.
|
|
823
|
+
*/
|
|
824
|
+
private enrichData;
|
|
825
|
+
private parseIIIFSequence;
|
|
826
|
+
/** Add an in-image micrio embed */
|
|
827
|
+
addEmbed(info: Partial<Models.ImageInfo.ImageInfo>, area: Models.Camera.View, opts?: Models.Embeds.EmbedOptions): MicrioImage;
|
|
828
|
+
/** Get the accompanying HTMLMediaElement for any in-image video embeds */
|
|
829
|
+
getEmbedMediaElement(id: string): HTMLMediaElement | undefined;
|
|
830
|
+
/** Fade in the individual image */
|
|
831
|
+
fadeIn(direct?: boolean): void;
|
|
832
|
+
fadeOut(direct?: boolean): void;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Video tour controller
|
|
836
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
837
|
+
* @copyright Q42 Internet BV, Micrio, 2015 - 2024
|
|
838
|
+
* @link https://micr.io/ , https://q42.nl/en/
|
|
839
|
+
*/
|
|
840
|
+
/** The Video Tour class */
|
|
841
|
+
export class VideoTourInstance {
|
|
842
|
+
private image;
|
|
843
|
+
private data;
|
|
844
|
+
/** The tour timeline */
|
|
845
|
+
private timeline;
|
|
846
|
+
private content;
|
|
847
|
+
/** Micrio instance */
|
|
848
|
+
private micrio;
|
|
849
|
+
/** Set the data */
|
|
850
|
+
constructor(image: MicrioImage, data: Models.ImageData.VideoTour);
|
|
851
|
+
destroy(): void;
|
|
852
|
+
/** Parse the timeline data */
|
|
853
|
+
read(): void;
|
|
854
|
+
get duration(): number;
|
|
855
|
+
set duration(v: number);
|
|
856
|
+
get paused(): boolean;
|
|
857
|
+
get ended(): boolean;
|
|
858
|
+
get currentTime(): number;
|
|
859
|
+
set currentTime(v: number);
|
|
860
|
+
get progress(): number;
|
|
861
|
+
set progress(v: number);
|
|
862
|
+
/** Play/resume the tour */
|
|
863
|
+
play(): void;
|
|
864
|
+
/** Pause the tour */
|
|
865
|
+
pause(): void;
|
|
866
|
+
/** Go to time segment index */
|
|
867
|
+
private gotoStep;
|
|
868
|
+
/** Go to the next tour segment */
|
|
869
|
+
private nextStep;
|
|
870
|
+
/** Get a viewport for a step index */
|
|
871
|
+
private getView;
|
|
872
|
+
/** Start a segment animation */
|
|
873
|
+
private startAni;
|
|
874
|
+
/** Set the tour to this progress percentage */
|
|
875
|
+
private setProgress;
|
|
876
|
+
/** Go to a timestamp in milliseconds */
|
|
877
|
+
private gotoTime;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* # Micrio JSON data model
|
|
881
|
+
*
|
|
882
|
+
* This page details the data models used by Micrio.
|
|
883
|
+
*
|
|
884
|
+
* This data is created in the [Micrio editor](https://dash.micr.io/), and published as static JSON file per image, and optionally any language-specific data such as image markers, tours, audio, etc.
|
|
885
|
+
*
|
|
886
|
+
* Each Micrio image uses two data sources, which are retrieved from the Micrio servers:
|
|
887
|
+
*
|
|
888
|
+
* 1. **{@link ImageInfo}**: `info.json`: the base image data such as resolution, image type, and basic image settings. This is accessible in JS as {@link MicrioImage.info} as the {@link SvelteStore.Readable} store, and {@link MicrioImage.$info} for its current value.
|
|
889
|
+
*
|
|
890
|
+
* 2. **{@link ImageData}**: `pub.json`: all published image content, which is accessible in JS as {@link MicrioImage.data} as the {@link SvelteStore.Writable} store, and {@link MicrioImage.$data} for its current value.
|
|
891
|
+
*
|
|
892
|
+
*/
|
|
893
|
+
export namespace Models {
|
|
894
|
+
type RevisionType = {
|
|
895
|
+
[key: string]: number;
|
|
896
|
+
};
|
|
897
|
+
/**
|
|
898
|
+
* # Base image data
|
|
899
|
+
*
|
|
900
|
+
* The MicrioData.ImageInfo.ImageInfo JSON data object, used to pass to {@link HTMLMicrioElement.open}.
|
|
901
|
+
*
|
|
902
|
+
* The static image information, such as original resolution, image type, title, and all non-language specific **settings** ({@link ImageInfo.Settings}), such as initial viewport, camera behavior, and 360° settings.
|
|
903
|
+
*
|
|
904
|
+
* The only required field is `id`. If only the `id` field is specified, Micrio attempts to download the additional image data by itself (`info.json`), published by the Micrio servers. This data will also include image title, and any custom viewing settings set in the image editor.
|
|
905
|
+
*
|
|
906
|
+
* This is a minimal accepted example:
|
|
907
|
+
*
|
|
908
|
+
* ```json
|
|
909
|
+
* {
|
|
910
|
+
* "id": "dzzLm",
|
|
911
|
+
* }
|
|
912
|
+
* ```
|
|
913
|
+
*
|
|
914
|
+
* If you have manually entered the image `width` and `height`, _it will not download_ the `info.json` file, assuming you have provided correct and complete data:
|
|
915
|
+
*
|
|
916
|
+
* ```json
|
|
917
|
+
* {
|
|
918
|
+
* "id": "dzzLm",
|
|
919
|
+
* "width": 41472,
|
|
920
|
+
* "height": 30219
|
|
921
|
+
* }
|
|
922
|
+
* ```
|
|
923
|
+
*
|
|
924
|
+
* Optionally, when using {@link HTMLMicrioElement} `<micr-io>` tag attributes, these will overwrite whatever is loaded from the server. So if in the Micrio editor you have enabled the fullscreen toggle button, you can disable it in your own HTML using `<micr-io data-fullscreen="false">`.
|
|
925
|
+
*
|
|
926
|
+
*
|
|
927
|
+
*/
|
|
928
|
+
namespace ImageInfo {
|
|
929
|
+
/** A Micrio image's main static image data object */
|
|
930
|
+
type ImageInfo = {
|
|
931
|
+
/** The image id
|
|
932
|
+
* @required
|
|
933
|
+
*/
|
|
934
|
+
id: string;
|
|
935
|
+
/** The image base path URI, with a trailing `/`
|
|
936
|
+
* @default https://b.micr.io/
|
|
937
|
+
*/
|
|
938
|
+
path: string;
|
|
939
|
+
/** The Micrio version this image was created in
|
|
940
|
+
* @default autoloaded
|
|
941
|
+
*/
|
|
942
|
+
version: number;
|
|
943
|
+
/** Created date */
|
|
944
|
+
created?: number;
|
|
945
|
+
/** For V5+: published revisions per language */
|
|
946
|
+
revision?: RevisionType;
|
|
947
|
+
/** The original image width
|
|
948
|
+
* @default autoloaded
|
|
949
|
+
*/
|
|
950
|
+
width: number;
|
|
951
|
+
/** The original image height
|
|
952
|
+
* @default autoloaded
|
|
953
|
+
*/
|
|
954
|
+
height: number;
|
|
955
|
+
/** The original tile size in px
|
|
956
|
+
* @default autoloaded
|
|
957
|
+
*/
|
|
958
|
+
tileSize: number;
|
|
959
|
+
/** Use an alternative image ID for the image tiles */
|
|
960
|
+
tilesId?: string;
|
|
961
|
+
/** Use an alternative basePath for image tiles */
|
|
962
|
+
tileBasePath?: string;
|
|
963
|
+
/** Optional custom file extension for tiles */
|
|
964
|
+
tileExtension?: string;
|
|
965
|
+
/** Force the `path` attribute to be used to get the info.json data */
|
|
966
|
+
forceInfoPath?: boolean;
|
|
967
|
+
/** The image settings, such as viewport/UI settings, camera and user event behavior
|
|
968
|
+
* NOTE: to modify this at runtime, use the MicrioImage.settings Writable store.
|
|
969
|
+
*/
|
|
970
|
+
settings?: Partial<ImageInfo.Settings>;
|
|
971
|
+
/** Optional organisation data */
|
|
972
|
+
organisation?: ImageInfo.Organisation;
|
|
973
|
+
/** The image title (default: autoloaded) */
|
|
974
|
+
title?: string;
|
|
975
|
+
/** The initial data language */
|
|
976
|
+
lang?: string;
|
|
977
|
+
/** The image is 360 degrees */
|
|
978
|
+
is360?: boolean;
|
|
979
|
+
/** The image tiles are in WebP format */
|
|
980
|
+
isWebP?: boolean;
|
|
981
|
+
/** The image tiles are in PNG format */
|
|
982
|
+
isPng?: boolean;
|
|
983
|
+
/** The tiled image is in DeepZoom format */
|
|
984
|
+
isDeepZoom?: boolean;
|
|
985
|
+
/** The image has a IIIF source */
|
|
986
|
+
isIIIF?: boolean;
|
|
987
|
+
/** Use a custom, single source uri for the zoomable image / video */
|
|
988
|
+
isSingle?: boolean;
|
|
989
|
+
/** A custom format (`dz` for DeepZoom, `iiif` for IIIF) */
|
|
990
|
+
format?: string;
|
|
991
|
+
/** Optional IIIF source for tiles */
|
|
992
|
+
iiifManifest?: string;
|
|
993
|
+
/** The album (V5+) ID */
|
|
994
|
+
albumId?: string;
|
|
995
|
+
/** The 360 tour space ID */
|
|
996
|
+
spacesId?: string;
|
|
997
|
+
};
|
|
998
|
+
interface Organisation {
|
|
999
|
+
name: string;
|
|
1000
|
+
slug: string;
|
|
1001
|
+
baseUrl?: string;
|
|
1002
|
+
href?: string;
|
|
1003
|
+
logo?: Assets.Image;
|
|
1004
|
+
gtmId?: string;
|
|
1005
|
+
branding?: boolean;
|
|
1006
|
+
fontFamily?: string;
|
|
1007
|
+
}
|
|
1008
|
+
/** Micrio image settings, which is on load included as {@link ImageInfo}`.settings`. */
|
|
1009
|
+
type Settings = {
|
|
1010
|
+
/** The starting viewport (`[x0,y0,x1,y1]`) */
|
|
1011
|
+
view?: Camera.View;
|
|
1012
|
+
/** Restrict navigation to this viewport (`[x0,y0,x1,y1]`) */
|
|
1013
|
+
restrict?: Camera.View;
|
|
1014
|
+
/** Load a cover-initing image focussed on this coordinate (`[x, y]`) */
|
|
1015
|
+
focus?: [number, number];
|
|
1016
|
+
/** When opening the image without a predefined deeplink, open this */
|
|
1017
|
+
start?: {
|
|
1018
|
+
type: ('marker' | 'markerTour' | 'tour' | 'page');
|
|
1019
|
+
id: string;
|
|
1020
|
+
};
|
|
1021
|
+
/** Use a custom uri for the info json file */
|
|
1022
|
+
infoUrl?: string;
|
|
1023
|
+
/** Render this image as a static image */
|
|
1024
|
+
static?: boolean;
|
|
1025
|
+
/** Use a custom thumbnail image uri */
|
|
1026
|
+
thumbSrc?: string;
|
|
1027
|
+
/** The starting viewport. Possible values `cover` and `contain`. Defaults to `contain` */
|
|
1028
|
+
initType?: string;
|
|
1029
|
+
/** The user cannot zoom out more than a fully covered view */
|
|
1030
|
+
limitToCoverScale?: boolean;
|
|
1031
|
+
/** Initialize the image when the container is scrolled into view (default: `false`) */
|
|
1032
|
+
lazyload?: number;
|
|
1033
|
+
/** Don't load any custom JS or CSS scripts */
|
|
1034
|
+
noExternals?: boolean;
|
|
1035
|
+
/** Don't load this image's {@link ImageData.ImageData} (markers, tours, etc) */
|
|
1036
|
+
skipMeta?: boolean;
|
|
1037
|
+
/** Don't auto-load first available non-preferred data language */
|
|
1038
|
+
onlyPreferredLang?: boolean;
|
|
1039
|
+
/** Do a crossfade when navigating between images (default: true) */
|
|
1040
|
+
fadeBetween?: boolean;
|
|
1041
|
+
/** Optional image crossfade duration, in seconds */
|
|
1042
|
+
crossfadeDuration?: number;
|
|
1043
|
+
/** Embedded images/videos fade in/out duration, in seconds */
|
|
1044
|
+
embedFadeDuration?: number;
|
|
1045
|
+
/** When being re-shown, always restart */
|
|
1046
|
+
embedRestartWhenShown?: boolean;
|
|
1047
|
+
/** Don't stop drawing frames when idle */
|
|
1048
|
+
keepRendering?: boolean;
|
|
1049
|
+
/** Don't load GTM module */
|
|
1050
|
+
noGTag?: boolean;
|
|
1051
|
+
/** With routing enabled, enable marker/tour deeplinks */
|
|
1052
|
+
routerMarkerTours?: boolean;
|
|
1053
|
+
/** Skip the deepest zoom levels */
|
|
1054
|
+
skipBaseLevels?: number;
|
|
1055
|
+
/** The camera animation speed (default: 1) */
|
|
1056
|
+
camspeed?: number;
|
|
1057
|
+
/** Kinetic dragging sensitivity (default: 1) */
|
|
1058
|
+
dragElasticity?: number;
|
|
1059
|
+
/** The maximum zoom level in % of the original (default: 1) */
|
|
1060
|
+
zoomLimit?: number;
|
|
1061
|
+
/** Turn off support for high DPI screens */
|
|
1062
|
+
noRetina?: boolean;
|
|
1063
|
+
/** Adjust the maximum zoom of high DPI screens to that of regular displays */
|
|
1064
|
+
zoomLimitDPRFix?: boolean;
|
|
1065
|
+
/** Allow the user to pan and zoom out of image bounds */
|
|
1066
|
+
freeMove?: boolean;
|
|
1067
|
+
/** When navigating back to this image from another image, reset the initial view */
|
|
1068
|
+
resetView?: boolean;
|
|
1069
|
+
/** Don't smooth out pixels when zooming in > 100% */
|
|
1070
|
+
noSmoothing?: boolean;
|
|
1071
|
+
/** Hook user events (default: true) */
|
|
1072
|
+
hookEvents?: boolean;
|
|
1073
|
+
/** Hook keyboard controls (default: false) */
|
|
1074
|
+
hookKeys?: boolean;
|
|
1075
|
+
/** Don't allow the user to zoom in or out */
|
|
1076
|
+
noZoom?: boolean;
|
|
1077
|
+
/** Use the mousewheel or trackpad scrolling for zooming (default: true) */
|
|
1078
|
+
hookScroll?: boolean;
|
|
1079
|
+
/** Allow pinch to zoom on touch devices (default: true) */
|
|
1080
|
+
hookPinch?: boolean;
|
|
1081
|
+
/** Allow panning through the image (default: true) */
|
|
1082
|
+
hookDrag?: boolean;
|
|
1083
|
+
/** Force two-finger panning on touch devices (default: false) */
|
|
1084
|
+
twoFingerPan?: boolean;
|
|
1085
|
+
/** Force using the CTRL/CMD-keys to zoom in using scrolling (default: false) */
|
|
1086
|
+
controlZoom?: boolean;
|
|
1087
|
+
/** Don't allow less than minimum scale zooming when pinching */
|
|
1088
|
+
pinchZoomOutLimit?: boolean;
|
|
1089
|
+
/** Don't load any UI elements */
|
|
1090
|
+
noUI?: boolean;
|
|
1091
|
+
/** Don't show any controls in the UI */
|
|
1092
|
+
noControls?: boolean;
|
|
1093
|
+
/** Show a fullscreen button if supported */
|
|
1094
|
+
fullscreen?: boolean;
|
|
1095
|
+
/** Don't show the Micrio logo on the top left */
|
|
1096
|
+
noLogo?: boolean;
|
|
1097
|
+
/** Don't show the organisation logo on the top right */
|
|
1098
|
+
noOrgLogo?: boolean;
|
|
1099
|
+
/** Don't show the menu bar with tours and custom pages */
|
|
1100
|
+
noToolbar?: boolean;
|
|
1101
|
+
/** Show an info modal with the image title and description */
|
|
1102
|
+
showInfo?: boolean;
|
|
1103
|
+
/** Show a social sharing button */
|
|
1104
|
+
social?: boolean;
|
|
1105
|
+
/** Show the minimap (default: true) */
|
|
1106
|
+
minimap?: boolean;
|
|
1107
|
+
/** Don't fade out the minimap (default: false) */
|
|
1108
|
+
alwaysShowMinimap?: boolean;
|
|
1109
|
+
/** The minimap maximum width, in px (default: 200) */
|
|
1110
|
+
minimapWidth?: number;
|
|
1111
|
+
/** The minimap maximum height, in px (default: 160) */
|
|
1112
|
+
minimapHeight?: number;
|
|
1113
|
+
/** More natural camera zooming animation during transitions (default: `true`) */
|
|
1114
|
+
doTourJumps?: boolean;
|
|
1115
|
+
/** Enable the audio controller (default: `true`) */
|
|
1116
|
+
audio?: boolean;
|
|
1117
|
+
/** The starting audio volume [0-1] (default: `1`) */
|
|
1118
|
+
startVolume?: number;
|
|
1119
|
+
/** The audio volume when other media is playing `[0-1]` (default: `0`) */
|
|
1120
|
+
mutedVolume?: number;
|
|
1121
|
+
/** Mute the audio when the current browser tab loses focus */
|
|
1122
|
+
muteOnBlur?: boolean;
|
|
1123
|
+
/** The physical width of the object in cm */
|
|
1124
|
+
cmWidth?: number;
|
|
1125
|
+
/** The physical height of the object in cm */
|
|
1126
|
+
cmHeight?: number;
|
|
1127
|
+
/** Overlapping markers are clustered */
|
|
1128
|
+
clusterMarkers?: boolean;
|
|
1129
|
+
/** The clustered marker radius */
|
|
1130
|
+
clusterMarkerRadius?: number;
|
|
1131
|
+
/** A static split-screen Micrio Image ID */
|
|
1132
|
+
micrioSplitLink?: string;
|
|
1133
|
+
/** When this is a secondary image in split screen, allow independent navigating */
|
|
1134
|
+
secondaryInteractive?: boolean;
|
|
1135
|
+
/** When this is a secondary image, don't follow the main image's navigation */
|
|
1136
|
+
noFollow?: boolean;
|
|
1137
|
+
/** Dark/light theme */
|
|
1138
|
+
theme?: ("dark" | "light" | "os");
|
|
1139
|
+
/** Load a custom JS file with this image */
|
|
1140
|
+
js?: {
|
|
1141
|
+
/** The asset href */
|
|
1142
|
+
href: string;
|
|
1143
|
+
};
|
|
1144
|
+
/** Load a custom CSS file with this image */
|
|
1145
|
+
css?: {
|
|
1146
|
+
/** The asset href */
|
|
1147
|
+
href: string;
|
|
1148
|
+
};
|
|
1149
|
+
/** All markers are scaled with the image */
|
|
1150
|
+
markersScale?: boolean;
|
|
1151
|
+
/** Albums */
|
|
1152
|
+
gallery?: GallerySettings;
|
|
1153
|
+
album?: AlbumInfo; /** V5 only */
|
|
1154
|
+
/** FOR OMNI OBJECTS */
|
|
1155
|
+
omni?: OmniSettings;
|
|
1156
|
+
/** Optional marker settings */
|
|
1157
|
+
_markers?: MarkerSettings;
|
|
1158
|
+
/** Optional settings for 360 images/video */
|
|
1159
|
+
_360?: {
|
|
1160
|
+
/** A 360 video object */
|
|
1161
|
+
video?: Assets.Video;
|
|
1162
|
+
/** Y rotation true north correction */
|
|
1163
|
+
trueNorth?: number;
|
|
1164
|
+
/** 2D embed X rotation in 360 */
|
|
1165
|
+
rotX?: number;
|
|
1166
|
+
/** 2D embed Y rotation in 360 */
|
|
1167
|
+
rotY?: number;
|
|
1168
|
+
/** 2D embed Z rotation in 360 */
|
|
1169
|
+
rotZ?: number;
|
|
1170
|
+
/** 2D embed IFRAME scale */
|
|
1171
|
+
scale?: number;
|
|
1172
|
+
};
|
|
1173
|
+
/** Freeform custom settings, this is the "Custom JSON" field in the image editor */
|
|
1174
|
+
_meta?: {
|
|
1175
|
+
[key: string]: any;
|
|
1176
|
+
};
|
|
1177
|
+
/** UI customizations */
|
|
1178
|
+
ui?: Partial<UserInterfaceSettings>;
|
|
1179
|
+
/** Grid: can click individual grid images */
|
|
1180
|
+
gridClickable?: boolean;
|
|
1181
|
+
/** Grid: transition duration, in seconds */
|
|
1182
|
+
gridTransitionDuration?: number;
|
|
1183
|
+
/** Grid: transition duration going back, in seconds */
|
|
1184
|
+
gridTransitionDurationOut?: number;
|
|
1185
|
+
};
|
|
1186
|
+
type GallerySettings = {
|
|
1187
|
+
/** Gallery has an associated .bin archive with thumbnails */
|
|
1188
|
+
archive?: string;
|
|
1189
|
+
/** Archive layer offset */
|
|
1190
|
+
archiveLayerOffset?: number;
|
|
1191
|
+
/** Gallery sorting */
|
|
1192
|
+
sort?: ('name' | '-name' | 'created' | '-created');
|
|
1193
|
+
/** Gallery type */
|
|
1194
|
+
type?: ('swipe' | 'swipe-full' | 'switch' | 'omni' | 'grid');
|
|
1195
|
+
/** The gallery opening image ID */
|
|
1196
|
+
startId?: string;
|
|
1197
|
+
/** Pages are combined to 2x1 spreads */
|
|
1198
|
+
isSpreads?: boolean;
|
|
1199
|
+
/** For spreads, number of cover pages to show as single page */
|
|
1200
|
+
coverPages?: number;
|
|
1201
|
+
revisions?: {
|
|
1202
|
+
[key: string]: RevisionType;
|
|
1203
|
+
};
|
|
1204
|
+
};
|
|
1205
|
+
type OmniSettings = {
|
|
1206
|
+
/** Number of frames */
|
|
1207
|
+
frames: number;
|
|
1208
|
+
/** Starting frame index */
|
|
1209
|
+
startIndex: number;
|
|
1210
|
+
/** The camera field of view in radians */
|
|
1211
|
+
fieldOfView: number;
|
|
1212
|
+
/** The camera vertical angle in radians */
|
|
1213
|
+
verticalAngle: number;
|
|
1214
|
+
/** The distance of the object center to the camera */
|
|
1215
|
+
distance: number;
|
|
1216
|
+
/** Adjust the center for an object */
|
|
1217
|
+
offsetX: number;
|
|
1218
|
+
/** Put the labels on the side of the object */
|
|
1219
|
+
sideLabels?: boolean;
|
|
1220
|
+
/** Which frame is 0deg rotation */
|
|
1221
|
+
frontIndex?: number;
|
|
1222
|
+
/** Layers */
|
|
1223
|
+
layers?: {
|
|
1224
|
+
i18n: {
|
|
1225
|
+
[key: string]: string | undefined;
|
|
1226
|
+
};
|
|
1227
|
+
}[];
|
|
1228
|
+
/** Hide the rotation dial */
|
|
1229
|
+
noDial?: boolean;
|
|
1230
|
+
/** Show degrees on dial */
|
|
1231
|
+
showDegrees?: boolean;
|
|
1232
|
+
/** Gallery is omni object photography over 2 axes */
|
|
1233
|
+
twoAxes?: boolean;
|
|
1234
|
+
/** Don't add key bindings for rotating */
|
|
1235
|
+
noKeys?: boolean;
|
|
1236
|
+
};
|
|
1237
|
+
/** Image-wide marker settings */
|
|
1238
|
+
type MarkerSettings = {
|
|
1239
|
+
/** An image-wise custom marker icon */
|
|
1240
|
+
markerIcon?: Assets.Image;
|
|
1241
|
+
/** The default marker color */
|
|
1242
|
+
markerColor?: string;
|
|
1243
|
+
/** The default marker size in px */
|
|
1244
|
+
markerSize?: string;
|
|
1245
|
+
/** Zoom out when closing a marker */
|
|
1246
|
+
zoomOutAfterClose?: boolean;
|
|
1247
|
+
/** Relative speed factor when zooming out after close */
|
|
1248
|
+
zoomOutAfterCloseSpeed?: number;
|
|
1249
|
+
/** Always show the titles for all markers */
|
|
1250
|
+
showTitles?: boolean;
|
|
1251
|
+
/** Don't print any marker titles at all */
|
|
1252
|
+
noTitles?: boolean;
|
|
1253
|
+
/** Don't scale titles if marker is scaling */
|
|
1254
|
+
titlesNoScale?: boolean;
|
|
1255
|
+
/** All markers are sized to their viewports */
|
|
1256
|
+
viewportIsMarker?: boolean;
|
|
1257
|
+
/** All marker embeds are printed in HTML, not WebGL */
|
|
1258
|
+
embedsInHtml?: boolean;
|
|
1259
|
+
/** Auto-start a marker tour when just opening marker */
|
|
1260
|
+
autoStartTour?: boolean;
|
|
1261
|
+
/** Always auto-start a marker tour from the beginning */
|
|
1262
|
+
autoStartTourAtBeginning?: boolean;
|
|
1263
|
+
/** Auto-progress a tour step when marker media has ended */
|
|
1264
|
+
tourAutoProgress?: boolean;
|
|
1265
|
+
/** Tour controls in popup */
|
|
1266
|
+
tourControlsInPopup?: boolean;
|
|
1267
|
+
/** Show tour step counter in marker popup */
|
|
1268
|
+
tourStepCounterInPopup?: boolean;
|
|
1269
|
+
/** Allow marker popups to be minimized */
|
|
1270
|
+
canMinimizePopup?: boolean;
|
|
1271
|
+
/** Svelte transition-in animation for popup */
|
|
1272
|
+
popupAnimation?: any;
|
|
1273
|
+
/** Place primary body text above any media in popup */
|
|
1274
|
+
primaryBodyFirst?: boolean;
|
|
1275
|
+
/** Prevent all autoplay */
|
|
1276
|
+
preventAutoPlay?: boolean;
|
|
1277
|
+
/** Don't do anything when clicking markers */
|
|
1278
|
+
noMarkerActions?: boolean;
|
|
1279
|
+
/** Hide markers when tour is running */
|
|
1280
|
+
hideMarkersDuringTour?: boolean;
|
|
1281
|
+
/** Keep popup opened in between marker tour steps */
|
|
1282
|
+
keepPopupsDuringTourTransitions?: boolean;
|
|
1283
|
+
/** Optional custom uploaded icons */
|
|
1284
|
+
customIcons?: Assets.Image[];
|
|
1285
|
+
};
|
|
1286
|
+
/** Custom interface settings */
|
|
1287
|
+
type UserInterfaceSettings = {
|
|
1288
|
+
controls?: {
|
|
1289
|
+
/** Show the culture switch button if there are multiple available languages */
|
|
1290
|
+
cultureSwitch?: boolean;
|
|
1291
|
+
/** Serial tour timebar clicking other segment always goes to start of chapter */
|
|
1292
|
+
serialTourNoTimeScrub?: boolean;
|
|
1293
|
+
};
|
|
1294
|
+
icons?: {
|
|
1295
|
+
/** The raw SVG string for zoom-in */
|
|
1296
|
+
zoomIn?: string;
|
|
1297
|
+
/** The raw SVG string for zoom-out */
|
|
1298
|
+
zoomOut?: string;
|
|
1299
|
+
/** The raw SVG string for fullscreen-start */
|
|
1300
|
+
fullscreenEnter?: string;
|
|
1301
|
+
/** The raw SVG string for fullscreen-stop */
|
|
1302
|
+
fullscreenLeave?: string;
|
|
1303
|
+
/** The raw SVG string for close */
|
|
1304
|
+
close?: string;
|
|
1305
|
+
/** Next step button */
|
|
1306
|
+
next?: string;
|
|
1307
|
+
/** Previous step button */
|
|
1308
|
+
prev?: string;
|
|
1309
|
+
/** Play button */
|
|
1310
|
+
play?: string;
|
|
1311
|
+
/** Pause button */
|
|
1312
|
+
pause?: string;
|
|
1313
|
+
/** Subtitles icon */
|
|
1314
|
+
subtitles?: string;
|
|
1315
|
+
/** Subtitles turned off icon */
|
|
1316
|
+
subtitlesOff?: string;
|
|
1317
|
+
/** Muted icon */
|
|
1318
|
+
muted?: string;
|
|
1319
|
+
/** Unmuted icon */
|
|
1320
|
+
unmuted?: string;
|
|
1321
|
+
/** Arrow up icon */
|
|
1322
|
+
up?: string;
|
|
1323
|
+
/** Arrow down icon */
|
|
1324
|
+
down?: string;
|
|
1325
|
+
};
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* # Image content data
|
|
1330
|
+
*
|
|
1331
|
+
* The image content {@link ImageData} JSON object, which is accessible as {@link MicrioImage.data} as the {@link SvelteStore.Writable} store, and {@link MicrioImage.$data} for its current value.
|
|
1332
|
+
*
|
|
1333
|
+
* This JSON data includes, for all published languages for this image:
|
|
1334
|
+
*
|
|
1335
|
+
* * Markers
|
|
1336
|
+
* * Marker tours
|
|
1337
|
+
* * Video tours
|
|
1338
|
+
* * Audio, music
|
|
1339
|
+
* * In-image embeds
|
|
1340
|
+
* * Custom menu screens and content pages
|
|
1341
|
+
*
|
|
1342
|
+
* To access the data of the current viewed image, use:
|
|
1343
|
+
*
|
|
1344
|
+
* ```js
|
|
1345
|
+
* // The current shown image value of the .data store Writable
|
|
1346
|
+
* const data = micrio.$current.$data;
|
|
1347
|
+
*
|
|
1348
|
+
* if(data) console.log(`The current image has ${data.markers.length} markers!`);
|
|
1349
|
+
* else console.warn('The current image has no data set.');
|
|
1350
|
+
* ```
|
|
1351
|
+
*
|
|
1352
|
+
* To subscribe to any data changes:
|
|
1353
|
+
*
|
|
1354
|
+
* ```js
|
|
1355
|
+
* micrio.$current.data.subscribe(data => {
|
|
1356
|
+
* console.log('Image has new or updated data!', data);
|
|
1357
|
+
* })
|
|
1358
|
+
* ```
|
|
1359
|
+
*
|
|
1360
|
+
* To set your own custom data:
|
|
1361
|
+
*
|
|
1362
|
+
* ```js
|
|
1363
|
+
* micrio.$current.data.set({
|
|
1364
|
+
* "markers": [
|
|
1365
|
+
* {
|
|
1366
|
+
* "i18n": {
|
|
1367
|
+
* "en": {
|
|
1368
|
+
* "title": "This is a test marker!"
|
|
1369
|
+
* }
|
|
1370
|
+
* },
|
|
1371
|
+
* "x": .5,
|
|
1372
|
+
* "y": .5
|
|
1373
|
+
* }
|
|
1374
|
+
* ]
|
|
1375
|
+
* })
|
|
1376
|
+
* ```
|
|
1377
|
+
*
|
|
1378
|
+
* Or to update an existing loaded data object:
|
|
1379
|
+
*
|
|
1380
|
+
* ```js
|
|
1381
|
+
* micrio.$current.data.update(data => {
|
|
1382
|
+
* data.markers.push({
|
|
1383
|
+
* "i18n": {
|
|
1384
|
+
* "en": {
|
|
1385
|
+
* "title": "This is a newly added marker"
|
|
1386
|
+
* }
|
|
1387
|
+
* },
|
|
1388
|
+
* "x": .6,
|
|
1389
|
+
* "y": .5
|
|
1390
|
+
* });
|
|
1391
|
+
* return data;
|
|
1392
|
+
* })
|
|
1393
|
+
* ```
|
|
1394
|
+
*/
|
|
1395
|
+
namespace ImageData {
|
|
1396
|
+
/** The main data JSON structure */
|
|
1397
|
+
type ImageData = {
|
|
1398
|
+
/** V5+: Save revision */
|
|
1399
|
+
revision?: RevisionType;
|
|
1400
|
+
/** Localized image details */
|
|
1401
|
+
i18n?: {
|
|
1402
|
+
[key: string]: ImageDetailsCultureData;
|
|
1403
|
+
};
|
|
1404
|
+
/** Markers */
|
|
1405
|
+
markers?: ImageData.Marker[];
|
|
1406
|
+
/** Marker tours */
|
|
1407
|
+
markerTours?: ImageData.MarkerTour[];
|
|
1408
|
+
/** Video tours */
|
|
1409
|
+
tours?: ImageData.VideoTour[];
|
|
1410
|
+
/** In-image embeds */
|
|
1411
|
+
embeds?: ImageData.Embed[];
|
|
1412
|
+
/** Custom menu pages */
|
|
1413
|
+
pages?: ImageData.Menu[];
|
|
1414
|
+
/** Music playlist */
|
|
1415
|
+
music?: {
|
|
1416
|
+
/** The audio assets */
|
|
1417
|
+
items: Assets.Audio[];
|
|
1418
|
+
/** Loop the playlist */
|
|
1419
|
+
loop: boolean;
|
|
1420
|
+
/** The music audio volume [0-1] (default: `1`) */
|
|
1421
|
+
volume?: number;
|
|
1422
|
+
};
|
|
1423
|
+
};
|
|
1424
|
+
interface ImageDetailsCultureData {
|
|
1425
|
+
/** Optional lang-specific image title */
|
|
1426
|
+
title?: string;
|
|
1427
|
+
/** Optional lang-specific image description */
|
|
1428
|
+
description?: string;
|
|
1429
|
+
/** Image copyright information */
|
|
1430
|
+
copyright?: string;
|
|
1431
|
+
/** Original source URI */
|
|
1432
|
+
sourceUrl?: string;
|
|
1433
|
+
}
|
|
1434
|
+
interface MarkerCultureData {
|
|
1435
|
+
/** The main marker title */
|
|
1436
|
+
title?: string;
|
|
1437
|
+
/** The marker url slug */
|
|
1438
|
+
slug?: string;
|
|
1439
|
+
/** Alternative title to display as marker label */
|
|
1440
|
+
label?: string;
|
|
1441
|
+
/** Marker main body HTML */
|
|
1442
|
+
body?: string;
|
|
1443
|
+
/** Marker secondary body HTML */
|
|
1444
|
+
bodySecondary?: string;
|
|
1445
|
+
/** Audio asset */
|
|
1446
|
+
audio?: Assets.Audio;
|
|
1447
|
+
/** An optional iframe embed url */
|
|
1448
|
+
embedUrl?: string;
|
|
1449
|
+
/** Embed title */
|
|
1450
|
+
embedTitle?: string;
|
|
1451
|
+
/** Embed description */
|
|
1452
|
+
embedDescription?: string;
|
|
1453
|
+
}
|
|
1454
|
+
/** A Marker */
|
|
1455
|
+
type Marker = {
|
|
1456
|
+
/** The marker ID */
|
|
1457
|
+
id: string;
|
|
1458
|
+
/** The relative marker X coordinate [0-1] */
|
|
1459
|
+
x: number;
|
|
1460
|
+
/** The relative marker Y coordinate [0-1] */
|
|
1461
|
+
y: number;
|
|
1462
|
+
i18n?: {
|
|
1463
|
+
[key: string]: MarkerCultureData;
|
|
1464
|
+
};
|
|
1465
|
+
/** Omni-objects: radius from center */
|
|
1466
|
+
radius?: number;
|
|
1467
|
+
/** Rotation is concave: it's on the back of a front-rounded shape */
|
|
1468
|
+
backside?: boolean;
|
|
1469
|
+
/** Omni-objects: offset rotation in radians */
|
|
1470
|
+
rotation?: number;
|
|
1471
|
+
/** Omni-objects: custom visibility between these radians */
|
|
1472
|
+
visibleArc?: [number, number];
|
|
1473
|
+
/** The viewport to zoom to when the marker is opened */
|
|
1474
|
+
view?: Camera.View;
|
|
1475
|
+
/** If an image has multiple layers, switch to this layer */
|
|
1476
|
+
imageLayer?: number;
|
|
1477
|
+
/** Content type, for displaying */
|
|
1478
|
+
type?: ('default' | 'image' | 'audio' | 'video' | 'media' | 'link' | 'waypoint' | 'cluster');
|
|
1479
|
+
/** Popup type */
|
|
1480
|
+
popupType: ('popup' | 'popover' | 'none' | 'micrioLink');
|
|
1481
|
+
/** Custom marker tags which will be also used as classnames on the marker elements */
|
|
1482
|
+
tags: string[];
|
|
1483
|
+
/** Autoplay the audio asset when the marker is opened */
|
|
1484
|
+
audioAutoPlay?: boolean;
|
|
1485
|
+
/** Autoplay video embed when the marker is opened */
|
|
1486
|
+
embedAutoPlay?: boolean;
|
|
1487
|
+
/** Don't draw a marker element */
|
|
1488
|
+
noMarker?: boolean;
|
|
1489
|
+
/** A custom HTML element instead of the default <button> */
|
|
1490
|
+
htmlElement?: HTMLElement;
|
|
1491
|
+
/** Having the embed iframe printed mutes audio */
|
|
1492
|
+
embedMutesAudio?: boolean;
|
|
1493
|
+
/** Images inside marker popup */
|
|
1494
|
+
images?: Assets.Image[];
|
|
1495
|
+
/** Video tour which plays when the marker is opened */
|
|
1496
|
+
videoTour?: VideoTour;
|
|
1497
|
+
/** Positional audio asset */
|
|
1498
|
+
positionalAudio?: Assets.AudioLocation;
|
|
1499
|
+
/** Optional function that overrides all behavior */
|
|
1500
|
+
onclick?: (m: Models.ImageData.Marker) => void;
|
|
1501
|
+
/** Additional options */
|
|
1502
|
+
data?: MarkerData;
|
|
1503
|
+
};
|
|
1504
|
+
/** Optional individual marker settings */
|
|
1505
|
+
type MarkerData = {
|
|
1506
|
+
/** A custom marker icon image */
|
|
1507
|
+
icon?: Assets.Image;
|
|
1508
|
+
/** A predefined custom icon idx in MarkerSettings */
|
|
1509
|
+
customIconIdx?: number;
|
|
1510
|
+
/** This marker links to this image */
|
|
1511
|
+
micrioLink?: Partial<ImageInfo.ImageInfo>;
|
|
1512
|
+
/** This marker opens secondary split image with id */
|
|
1513
|
+
micrioSplitLink?: string;
|
|
1514
|
+
/** Don't animate the camera when opening this marker */
|
|
1515
|
+
noAnimate?: boolean;
|
|
1516
|
+
/** Show the title below the marker
|
|
1517
|
+
* @deprecated Use the main marker setting for this
|
|
1518
|
+
*/
|
|
1519
|
+
showTitle?: boolean;
|
|
1520
|
+
/** Don't open a large image viewer/gallery on image click */
|
|
1521
|
+
preventImageOpen?: boolean;
|
|
1522
|
+
/** Force a marker popup no matter what */
|
|
1523
|
+
notEmpty?: boolean;
|
|
1524
|
+
/** Jump the camera when opening this marker */
|
|
1525
|
+
doJump?: boolean;
|
|
1526
|
+
/** This marker is not closeable */
|
|
1527
|
+
alwaysOpen?: boolean;
|
|
1528
|
+
/** The marker scales with the zooming image */
|
|
1529
|
+
scales?: boolean;
|
|
1530
|
+
/** Grid tour transition animation */
|
|
1531
|
+
gridTourTransition?: Grid.MarkerFocusTransition;
|
|
1532
|
+
/** Optional custom settings. This is the "Custom JSON" field in the marker editor */
|
|
1533
|
+
_meta?: {
|
|
1534
|
+
/** For in grid multi-image tour, this step is in grid view */
|
|
1535
|
+
gridView?: boolean;
|
|
1536
|
+
/** Custom grid actions, action and action data |-separated */
|
|
1537
|
+
gridAction?: string;
|
|
1538
|
+
/** When opening this marker inside a grid, resize the tile to this */
|
|
1539
|
+
gridSize?: number | string;
|
|
1540
|
+
/** Any other value is accepted */
|
|
1541
|
+
[key: string]: any;
|
|
1542
|
+
};
|
|
1543
|
+
};
|
|
1544
|
+
/**
|
|
1545
|
+
* An embedded element inside the main image. This could be an image,
|
|
1546
|
+
* iframe embed, or simple empty HTML element (Spaces).
|
|
1547
|
+
* This is created in the [Micrio editor](https://dash.micr.io/) or Spaces.
|
|
1548
|
+
*/
|
|
1549
|
+
type Embed = Partial<ImageInfo.ImageInfo> & {
|
|
1550
|
+
/** The area inside the main image to place the embed */
|
|
1551
|
+
area: Camera.View;
|
|
1552
|
+
/** Original asset url */
|
|
1553
|
+
src?: string;
|
|
1554
|
+
/** An optional iframe src url */
|
|
1555
|
+
frameSrc?: string;
|
|
1556
|
+
/** Autoplay YT/Vimeo */
|
|
1557
|
+
autoplayFrame?: boolean;
|
|
1558
|
+
/** Optional title */
|
|
1559
|
+
title?: string;
|
|
1560
|
+
/** An optional Micrio ID */
|
|
1561
|
+
micrioId?: string;
|
|
1562
|
+
/** Optional image width */
|
|
1563
|
+
width?: number;
|
|
1564
|
+
/** Optional image height */
|
|
1565
|
+
height?: number;
|
|
1566
|
+
/** Optional isPng */
|
|
1567
|
+
isPng?: boolean;
|
|
1568
|
+
/** IsWebP */
|
|
1569
|
+
isWebP?: boolean;
|
|
1570
|
+
/** Opacity */
|
|
1571
|
+
opacity?: number;
|
|
1572
|
+
/** Click interaction */
|
|
1573
|
+
clickAction?: ('markerId' | 'href');
|
|
1574
|
+
/** Click action target */
|
|
1575
|
+
clickTarget?: string;
|
|
1576
|
+
/** Opens link in new window */
|
|
1577
|
+
clickTargetBlank?: boolean;
|
|
1578
|
+
/** Unique instance ID */
|
|
1579
|
+
uuid?: string;
|
|
1580
|
+
/** Relative scale for IFRAME embed in 360 */
|
|
1581
|
+
scale?: number;
|
|
1582
|
+
/** X rotation in 360 */
|
|
1583
|
+
rotX?: number;
|
|
1584
|
+
/** Y rotation in 360 */
|
|
1585
|
+
rotY?: number;
|
|
1586
|
+
/** Z rotation in 360 */
|
|
1587
|
+
rotZ?: number;
|
|
1588
|
+
scaleX?: number;
|
|
1589
|
+
scaleY?: number;
|
|
1590
|
+
/** A video asset */
|
|
1591
|
+
video?: Assets.Video & {
|
|
1592
|
+
/** Don't play video when smaller than % of screen */
|
|
1593
|
+
pauseWhenSmallerThan?: number;
|
|
1594
|
+
/** Don't play video when larger than % of screen */
|
|
1595
|
+
pauseWhenLargerThan?: number;
|
|
1596
|
+
};
|
|
1597
|
+
/** Hide while not playing video/media */
|
|
1598
|
+
hideWhenPaused?: boolean;
|
|
1599
|
+
};
|
|
1600
|
+
interface TourCultureData {
|
|
1601
|
+
/** The tour title */
|
|
1602
|
+
title?: string;
|
|
1603
|
+
/** The tour url slug */
|
|
1604
|
+
slug?: string;
|
|
1605
|
+
/** The tour description */
|
|
1606
|
+
description?: string;
|
|
1607
|
+
}
|
|
1608
|
+
/** The MicrioTour abstract shared class for both {@link MarkerTour} and {@link VideoTour}
|
|
1609
|
+
* @abstract
|
|
1610
|
+
*/
|
|
1611
|
+
type Tour = {
|
|
1612
|
+
/** The tour id */
|
|
1613
|
+
id: string;
|
|
1614
|
+
/** Localized tour culture data */
|
|
1615
|
+
i18n?: {
|
|
1616
|
+
[key: string]: TourCultureData;
|
|
1617
|
+
};
|
|
1618
|
+
/** Auto-minimize controls while playing and idle */
|
|
1619
|
+
minimize?: boolean;
|
|
1620
|
+
/** Cannot close this tour */
|
|
1621
|
+
cannotClose?: boolean;
|
|
1622
|
+
/** Exit the tour on finish */
|
|
1623
|
+
closeOnFinish?: boolean;
|
|
1624
|
+
};
|
|
1625
|
+
/** A single videotour timeline viewport */
|
|
1626
|
+
type VideoTourView = {
|
|
1627
|
+
/** Start time in seconds */
|
|
1628
|
+
start: number;
|
|
1629
|
+
/** End time in seconds */
|
|
1630
|
+
end: number;
|
|
1631
|
+
/** Viewport name */
|
|
1632
|
+
title?: string;
|
|
1633
|
+
/** View rectangle */
|
|
1634
|
+
rect: Camera.View;
|
|
1635
|
+
};
|
|
1636
|
+
interface VideoTourCultureData extends TourCultureData {
|
|
1637
|
+
/** The tour duration in seconds */
|
|
1638
|
+
duration: number;
|
|
1639
|
+
/** An optional audio file */
|
|
1640
|
+
audio?: Assets.Audio;
|
|
1641
|
+
/** Optional subtitles */
|
|
1642
|
+
subtitle?: Assets.Subtitle;
|
|
1643
|
+
/** The timeline data */
|
|
1644
|
+
timeline: VideoTourView[];
|
|
1645
|
+
/** Custom events in tour timeline */
|
|
1646
|
+
events: Event[];
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* A Micrio video tour -- a timed sequence of viewport, with optional audio file.
|
|
1650
|
+
* This is created in the [Micrio editor](https://dash.micr.io/).
|
|
1651
|
+
*/
|
|
1652
|
+
type VideoTour = Tour & {
|
|
1653
|
+
/** Localized videotour culture data */
|
|
1654
|
+
i18n?: {
|
|
1655
|
+
[key: string]: VideoTourCultureData;
|
|
1656
|
+
};
|
|
1657
|
+
/** Don't hide the markers when running */
|
|
1658
|
+
keepMarkers?: boolean;
|
|
1659
|
+
/** Don't disable user navigation when running */
|
|
1660
|
+
keepInteraction?: boolean;
|
|
1661
|
+
/** Current running tour instance */
|
|
1662
|
+
instance?: VideoTourInstance;
|
|
1663
|
+
};
|
|
1664
|
+
/** Timed events inside a {@link ImageData.VideoTour} */
|
|
1665
|
+
type Event = {
|
|
1666
|
+
/** Start time in seconds */
|
|
1667
|
+
start: number;
|
|
1668
|
+
/** End time in seconds */
|
|
1669
|
+
end: number;
|
|
1670
|
+
/** Custom event name */
|
|
1671
|
+
action?: string;
|
|
1672
|
+
/** Custom event data */
|
|
1673
|
+
data?: string;
|
|
1674
|
+
/** Optional ID to hook to */
|
|
1675
|
+
id?: string;
|
|
1676
|
+
/** The event is currently active */
|
|
1677
|
+
active?: boolean;
|
|
1678
|
+
};
|
|
1679
|
+
/**
|
|
1680
|
+
* A Micrio marker tour -- a sequence of markers, which the user can navigate
|
|
1681
|
+
* through. This is created in the [Micrio editor](https://dash.micr.io/).
|
|
1682
|
+
*/
|
|
1683
|
+
type MarkerTour = Tour & {
|
|
1684
|
+
/** Tour steps */
|
|
1685
|
+
steps: string[];
|
|
1686
|
+
/** No user controls */
|
|
1687
|
+
noControls?: boolean;
|
|
1688
|
+
/** Optional tour image asset */
|
|
1689
|
+
image?: Assets.Image;
|
|
1690
|
+
/** This is a scrolling tour */
|
|
1691
|
+
scrollable?: boolean;
|
|
1692
|
+
/** Don't reset view when tour ends */
|
|
1693
|
+
keepLastStep?: boolean;
|
|
1694
|
+
/** Chapter-based multi-video serial tour */
|
|
1695
|
+
isSerialTour?: boolean;
|
|
1696
|
+
/** Print the chapters in the interface */
|
|
1697
|
+
printChapters?: boolean;
|
|
1698
|
+
/** Internally generated propagated step data by Micrio */
|
|
1699
|
+
stepInfo?: MarkerTourStepInfo[];
|
|
1700
|
+
/** Internally calculated total duration, sum of all step durations */
|
|
1701
|
+
duration?: number;
|
|
1702
|
+
/** Current tour step getter */
|
|
1703
|
+
currentStep?: number;
|
|
1704
|
+
/** Start on this tour step */
|
|
1705
|
+
initialStep?: number;
|
|
1706
|
+
/** Go to next step -- for running tours */
|
|
1707
|
+
next?: () => void;
|
|
1708
|
+
/** Go to prev step -- for running tours */
|
|
1709
|
+
prev?: () => void;
|
|
1710
|
+
/** Go to step -- for running tours */
|
|
1711
|
+
goto?: (n: number) => void;
|
|
1712
|
+
};
|
|
1713
|
+
/** Auto generated metadata for marker tours */
|
|
1714
|
+
type MarkerTourStepInfo = {
|
|
1715
|
+
markerId: string;
|
|
1716
|
+
marker: Marker;
|
|
1717
|
+
micrioId: string;
|
|
1718
|
+
duration: number;
|
|
1719
|
+
imageHasOtherMarkers?: boolean;
|
|
1720
|
+
startView?: Camera.View;
|
|
1721
|
+
chapter?: number;
|
|
1722
|
+
/** For in grid multi-image tour, stay in the grid view */
|
|
1723
|
+
gridView?: boolean;
|
|
1724
|
+
/** Media current time */
|
|
1725
|
+
currentTime?: number;
|
|
1726
|
+
/** Media has ended */
|
|
1727
|
+
ended?: boolean;
|
|
1728
|
+
};
|
|
1729
|
+
interface MenuPageButton {
|
|
1730
|
+
/** Localized button title */
|
|
1731
|
+
i18nTitle: {
|
|
1732
|
+
[key: string]: string;
|
|
1733
|
+
};
|
|
1734
|
+
/** Button action type */
|
|
1735
|
+
type: ('close' | 'marker' | 'mtour' | 'vtour' | 'link');
|
|
1736
|
+
/** The action value */
|
|
1737
|
+
action?: string;
|
|
1738
|
+
/** Link opens in net tab */
|
|
1739
|
+
blankTarget?: boolean;
|
|
1740
|
+
}
|
|
1741
|
+
interface MenuCultureData {
|
|
1742
|
+
/** The menu title */
|
|
1743
|
+
title?: string;
|
|
1744
|
+
/** For page: iframe embed */
|
|
1745
|
+
embed?: string;
|
|
1746
|
+
/** For page: content HTML */
|
|
1747
|
+
content?: string;
|
|
1748
|
+
}
|
|
1749
|
+
/**
|
|
1750
|
+
* A custom pop-out menu containing content pages or direct external links to
|
|
1751
|
+
* websites, or direct links to opening a marker.
|
|
1752
|
+
* This is created in the [Micrio editor](https://dash.micr.io/).
|
|
1753
|
+
*/
|
|
1754
|
+
type Menu = {
|
|
1755
|
+
/** The menu ID */
|
|
1756
|
+
id: string;
|
|
1757
|
+
/** Localized culture data */
|
|
1758
|
+
i18n?: {
|
|
1759
|
+
[key: string]: MenuCultureData;
|
|
1760
|
+
};
|
|
1761
|
+
/** Child menu elements */
|
|
1762
|
+
children?: Menu[];
|
|
1763
|
+
/** Open this marker when clicking menu */
|
|
1764
|
+
markerId?: string;
|
|
1765
|
+
/** Direct link url for menu button */
|
|
1766
|
+
link?: string;
|
|
1767
|
+
/** Opens the link in a new window */
|
|
1768
|
+
linkTargetBlank?: boolean;
|
|
1769
|
+
/** Optional direct action function when clicked */
|
|
1770
|
+
action?: Function;
|
|
1771
|
+
/** For page: page image */
|
|
1772
|
+
image?: Assets.Image;
|
|
1773
|
+
/** Custom page action buttons */
|
|
1774
|
+
buttons?: MenuPageButton[];
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
namespace Assets {
|
|
1778
|
+
type BaseAsset = {
|
|
1779
|
+
/** The asset title (not filename) */
|
|
1780
|
+
title: string;
|
|
1781
|
+
/** The asset file name */
|
|
1782
|
+
fileName?: string;
|
|
1783
|
+
/** The file uri */
|
|
1784
|
+
src: string;
|
|
1785
|
+
/** File size in bytes */
|
|
1786
|
+
size: number;
|
|
1787
|
+
/** Created */
|
|
1788
|
+
uploaded: number;
|
|
1789
|
+
};
|
|
1790
|
+
type Audio = BaseAsset & {
|
|
1791
|
+
/** The sample duration */
|
|
1792
|
+
duration: number;
|
|
1793
|
+
/** The sample volume */
|
|
1794
|
+
volume: number;
|
|
1795
|
+
};
|
|
1796
|
+
type AudioLocation = Audio & {
|
|
1797
|
+
/** Autoplay the sample */
|
|
1798
|
+
alwaysPlay: boolean;
|
|
1799
|
+
/** Loop the audio */
|
|
1800
|
+
loop: boolean;
|
|
1801
|
+
/** Pause X seconds between plays */
|
|
1802
|
+
repeatAfter: number;
|
|
1803
|
+
/** Don't play on mobile */
|
|
1804
|
+
noMobile: boolean;
|
|
1805
|
+
/** The radius of the audible circle */
|
|
1806
|
+
radius: number;
|
|
1807
|
+
};
|
|
1808
|
+
/** An image asset uploaded in the Micrio editor */
|
|
1809
|
+
type Image = BaseAsset & {
|
|
1810
|
+
id?: string;
|
|
1811
|
+
/** The image original width */
|
|
1812
|
+
width: number;
|
|
1813
|
+
/** The image original height */
|
|
1814
|
+
height: number;
|
|
1815
|
+
/** If the image is available as Micrio image, its ID */
|
|
1816
|
+
micrioId?: string;
|
|
1817
|
+
/** If the image has a Micrio version, optional alternative image tile ID */
|
|
1818
|
+
tilesId?: string;
|
|
1819
|
+
/** Is PNG */
|
|
1820
|
+
isPng?: boolean;
|
|
1821
|
+
/** IsWebP */
|
|
1822
|
+
isWebP?: boolean;
|
|
1823
|
+
/** Used DeepZoom format */
|
|
1824
|
+
isDeepZoom?: boolean;
|
|
1825
|
+
/** V5+: Translatable description */
|
|
1826
|
+
i18n?: {
|
|
1827
|
+
[key: string]: {
|
|
1828
|
+
title?: string;
|
|
1829
|
+
description?: string;
|
|
1830
|
+
};
|
|
1831
|
+
};
|
|
1832
|
+
};
|
|
1833
|
+
type Video = BaseAsset & {
|
|
1834
|
+
/** The video width */
|
|
1835
|
+
width: number;
|
|
1836
|
+
/** The video height */
|
|
1837
|
+
height: number;
|
|
1838
|
+
/** The video duration */
|
|
1839
|
+
duration: number;
|
|
1840
|
+
/** Video is muted */
|
|
1841
|
+
muted: boolean;
|
|
1842
|
+
/** Video loops */
|
|
1843
|
+
loop: boolean;
|
|
1844
|
+
/** Video loops after X seconds waiting */
|
|
1845
|
+
loopAfter?: number;
|
|
1846
|
+
/** Video autoplays */
|
|
1847
|
+
autoplay: boolean;
|
|
1848
|
+
/** Cloudflare Stream ID */
|
|
1849
|
+
streamId?: string;
|
|
1850
|
+
/** Show controls */
|
|
1851
|
+
controls: boolean;
|
|
1852
|
+
/** Video has alpha transparency */
|
|
1853
|
+
transparent: boolean;
|
|
1854
|
+
/** Video has a separately uploaded Mac H265 transparent src */
|
|
1855
|
+
hasH265?: boolean;
|
|
1856
|
+
};
|
|
1857
|
+
type Subtitle = BaseAsset;
|
|
1858
|
+
}
|
|
1859
|
+
/** 360 tours, formerly SPACES */
|
|
1860
|
+
namespace Spaces {
|
|
1861
|
+
interface SpaceImage {
|
|
1862
|
+
/** The Micrio ID */
|
|
1863
|
+
id: string;
|
|
1864
|
+
/** X position of 360 image in zone */
|
|
1865
|
+
x: number;
|
|
1866
|
+
/** Y position of 360 image in zone */
|
|
1867
|
+
y: number;
|
|
1868
|
+
/** Z position of 360 image in zone */
|
|
1869
|
+
z: number;
|
|
1870
|
+
/** RotationY => .trueNorth */
|
|
1871
|
+
rotationY: number;
|
|
1872
|
+
}
|
|
1873
|
+
interface Space {
|
|
1874
|
+
/** The 360 image */
|
|
1875
|
+
images: SpaceImage[];
|
|
1876
|
+
/** The zone name */
|
|
1877
|
+
name: string;
|
|
1878
|
+
/** 360 linked Micrio IDs */
|
|
1879
|
+
links: [string, string, {
|
|
1880
|
+
[key: string]: WayPointSettings;
|
|
1881
|
+
}?][];
|
|
1882
|
+
/** Custom icon lib */
|
|
1883
|
+
icons?: Assets.Image[];
|
|
1884
|
+
/** Multi-image marker tours */
|
|
1885
|
+
markerTours?: Models.ImageData.MarkerTour[];
|
|
1886
|
+
}
|
|
1887
|
+
interface WaypointInterface {
|
|
1888
|
+
el?: HTMLElement;
|
|
1889
|
+
settings: WayPointSettings;
|
|
1890
|
+
coords: WaypointCoords;
|
|
1891
|
+
deleted?: boolean;
|
|
1892
|
+
}
|
|
1893
|
+
interface WayPointSettings {
|
|
1894
|
+
i18n: {
|
|
1895
|
+
[key: string]: {
|
|
1896
|
+
title: string;
|
|
1897
|
+
};
|
|
1898
|
+
};
|
|
1899
|
+
/** A predefined custom icon idx */
|
|
1900
|
+
customIconIdx?: number;
|
|
1901
|
+
coords?: WaypointCoords;
|
|
1902
|
+
}
|
|
1903
|
+
type DirectionVector = [number, number, number];
|
|
1904
|
+
interface WaypointCoords {
|
|
1905
|
+
x: number;
|
|
1906
|
+
y: number;
|
|
1907
|
+
baseScale: number;
|
|
1908
|
+
scale: number;
|
|
1909
|
+
rotX: number;
|
|
1910
|
+
rotY: number;
|
|
1911
|
+
rotZ: number;
|
|
1912
|
+
custom?: boolean;
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
/** OmniImages */
|
|
1916
|
+
namespace Omni {
|
|
1917
|
+
interface Frame {
|
|
1918
|
+
id: string;
|
|
1919
|
+
image: MicrioImage;
|
|
1920
|
+
visible: Writable<boolean>;
|
|
1921
|
+
frame: number;
|
|
1922
|
+
thumbSrc?: string;
|
|
1923
|
+
baseTileIdx: number;
|
|
1924
|
+
ptr: number;
|
|
1925
|
+
opts: {
|
|
1926
|
+
area: Camera.View;
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
namespace Grid {
|
|
1931
|
+
/** Grid .focus() transition from current view */
|
|
1932
|
+
type MarkerFocusTransition = ('crossfade' | 'slide' | 'slide-horiz' | 'slide-vert' | 'slide-up' | 'slide-down' | 'slide-right' | 'slide-left' | 'swipe' | 'swipe-horiz' | 'swipe-vert' | 'swipe-up' | 'swipe-down' | 'swipe-right' | 'swipe-left' | 'behind' | 'behind-left' | 'behind-right');
|
|
1933
|
+
type GridSetTransition = ('crossfade' | 'behind' | 'behind-delayed' | 'appear-delayed');
|
|
1934
|
+
/** Virtual ImageInfo extension to support grid logic */
|
|
1935
|
+
interface GridImage extends Partial<Models.ImageInfo.ImageInfo> {
|
|
1936
|
+
size: [number, number?];
|
|
1937
|
+
area?: Camera.View;
|
|
1938
|
+
view?: Camera.View;
|
|
1939
|
+
}
|
|
1940
|
+
interface GridHistory {
|
|
1941
|
+
layout: string;
|
|
1942
|
+
horizontal: boolean;
|
|
1943
|
+
view?: Camera.View;
|
|
1944
|
+
}
|
|
1945
|
+
interface GridImageOptions {
|
|
1946
|
+
view?: Camera.View;
|
|
1947
|
+
area?: Camera.View;
|
|
1948
|
+
size?: number[];
|
|
1949
|
+
}
|
|
1950
|
+
interface FocusOptions {
|
|
1951
|
+
/** Optional target image view */
|
|
1952
|
+
view?: Camera.View;
|
|
1953
|
+
/** Transition duration in ms */
|
|
1954
|
+
duration?: number;
|
|
1955
|
+
/** Transition animation, defaults to crossfade */
|
|
1956
|
+
transition?: Models.Grid.MarkerFocusTransition;
|
|
1957
|
+
/** Set the target viewport immediately */
|
|
1958
|
+
noViewAni?: boolean;
|
|
1959
|
+
/** Animate the previously focussed image to this view during exit transition */
|
|
1960
|
+
exitView?: Camera.View;
|
|
1961
|
+
/** Limit the focussed image to cover view, defaults to false */
|
|
1962
|
+
coverLimit?: boolean;
|
|
1963
|
+
/** Open as cover view, but don't limit it */
|
|
1964
|
+
cover?: boolean;
|
|
1965
|
+
/** Blur the image during transition, in pixels */
|
|
1966
|
+
blur?: number;
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
/** Albums */
|
|
1970
|
+
interface AlbumInfo {
|
|
1971
|
+
/** The album ID */
|
|
1972
|
+
id: string;
|
|
1973
|
+
/** The album name */
|
|
1974
|
+
name: string;
|
|
1975
|
+
/** The album UX type */
|
|
1976
|
+
type: ('swipe' | 'switch' | 'grid');
|
|
1977
|
+
/** The album image sorting */
|
|
1978
|
+
sort?: ('name' | '-name' | 'created' | '-created');
|
|
1979
|
+
/** Album pages are shown as book spreads */
|
|
1980
|
+
isSpreads?: boolean;
|
|
1981
|
+
/** The number of single cover pages in case of spreads */
|
|
1982
|
+
coverPages?: number;
|
|
1983
|
+
/** Published revision number */
|
|
1984
|
+
revision: number;
|
|
1985
|
+
/** Available page data (markers, etc) */
|
|
1986
|
+
published: {
|
|
1987
|
+
[key: string]: RevisionType;
|
|
1988
|
+
};
|
|
1989
|
+
/** Album organisation */
|
|
1990
|
+
organisation?: ImageInfo.Organisation;
|
|
1991
|
+
}
|
|
1992
|
+
interface Album {
|
|
1993
|
+
/** The number of pages in this album */
|
|
1994
|
+
numPages: number;
|
|
1995
|
+
/** The current page index */
|
|
1996
|
+
currentIndex: number;
|
|
1997
|
+
/** The album info */
|
|
1998
|
+
info?: AlbumInfo;
|
|
1999
|
+
/** Go to previous page */
|
|
2000
|
+
prev: () => void;
|
|
2001
|
+
/** Go to next page */
|
|
2002
|
+
next: () => void;
|
|
2003
|
+
/** Go to specific page index */
|
|
2004
|
+
goto: (n: number) => void;
|
|
2005
|
+
/** Album has been initialized and hooked */
|
|
2006
|
+
hooked?: boolean;
|
|
2007
|
+
}
|
|
2008
|
+
namespace Camera {
|
|
2009
|
+
/** A viewport rectangle */
|
|
2010
|
+
type View = number[] | Float64Array;
|
|
2011
|
+
/** Coordinate tuple, [x, y, scale] */
|
|
2012
|
+
type Coords = [number, number, number?] | Float64Array;
|
|
2013
|
+
/** A 360 vector for use in Spaces */
|
|
2014
|
+
type Vector = {
|
|
2015
|
+
direction: number;
|
|
2016
|
+
distanceX: number;
|
|
2017
|
+
distanceY: number;
|
|
2018
|
+
};
|
|
2019
|
+
type TimingFunction = ('ease' | 'ease-in' | 'ease-out' | 'linear');
|
|
2020
|
+
interface AnimationOptions {
|
|
2021
|
+
/** Animation duration in ms */
|
|
2022
|
+
duration?: number;
|
|
2023
|
+
/** Limit the viewport to fill the screen */
|
|
2024
|
+
limit?: boolean;
|
|
2025
|
+
/** In case of automatic duration, speed factor (1 = 100%) */
|
|
2026
|
+
speed?: number;
|
|
2027
|
+
/** Transition timing function */
|
|
2028
|
+
timingFunction?: TimingFunction;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
namespace Embeds {
|
|
2032
|
+
interface EmbedOptions {
|
|
2033
|
+
/** The embed opacity */
|
|
2034
|
+
opacity?: number;
|
|
2035
|
+
/** Do not print this embed until this zoom level (% of original) */
|
|
2036
|
+
fromScale?: number;
|
|
2037
|
+
/** The embed will have a minimal memory footprint, without its own camera */
|
|
2038
|
+
asImage?: boolean;
|
|
2039
|
+
/** Fit the embed's original size into the specified area. Defaults to 'stretch' */
|
|
2040
|
+
fit?: ('contain' | 'cover' | 'stretch');
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
namespace State {
|
|
2044
|
+
/** Popover interface state type */
|
|
2045
|
+
interface PopoverType {
|
|
2046
|
+
contentPage?: Models.ImageData.Menu;
|
|
2047
|
+
image?: MicrioImage;
|
|
2048
|
+
marker?: Models.ImageData.Marker;
|
|
2049
|
+
markerTour?: Models.ImageData.MarkerTour;
|
|
2050
|
+
gallery?: Models.Assets.Image[];
|
|
2051
|
+
galleryStart?: string;
|
|
2052
|
+
showLangSelect?: boolean;
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
namespace Canvas {
|
|
2056
|
+
interface ViewRect {
|
|
2057
|
+
width: number;
|
|
2058
|
+
height: number;
|
|
2059
|
+
left: number;
|
|
2060
|
+
top: number;
|
|
2061
|
+
ratio: number;
|
|
2062
|
+
scale: number;
|
|
2063
|
+
portrait: boolean;
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Micrio user input event handler
|
|
2069
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
2070
|
+
* @copyright Q42 Internet BV, Micrio, 2015 - 2024
|
|
2071
|
+
* @link https://micr.io/ , https://q42.nl/en/
|
|
2072
|
+
*/
|
|
2073
|
+
export class Events {
|
|
2074
|
+
/** Enable/disable events */
|
|
2075
|
+
enabled: Writable<boolean>;
|
|
2076
|
+
/** Enabled state getter */
|
|
2077
|
+
get $enabled(): boolean;
|
|
2078
|
+
/** User is pinching above certain treshold */
|
|
2079
|
+
pinchFactor: number | undefined;
|
|
2080
|
+
/** User is currently manually navigating or not
|
|
2081
|
+
* @returns Whether the user is using mouse/gestures to navigate right now
|
|
2082
|
+
*/
|
|
2083
|
+
get isNavigating(): boolean;
|
|
2084
|
+
/** Hook all event listeners */
|
|
2085
|
+
hook(): void;
|
|
2086
|
+
/** Unhook all event listeners */
|
|
2087
|
+
unhook(): void;
|
|
2088
|
+
/** Hook keyboard event listeners */
|
|
2089
|
+
hookKeys(): void;
|
|
2090
|
+
/** Unhook keyboard event listeners */
|
|
2091
|
+
unhookKeys(): void;
|
|
2092
|
+
/** Hook all zoom event listeners */
|
|
2093
|
+
hookZoom(): void;
|
|
2094
|
+
/** Remove all zoom event listeners */
|
|
2095
|
+
unhookZoom(): void;
|
|
2096
|
+
scrollHooked: boolean;
|
|
2097
|
+
/** Hook mousewheel / scroll event listeners */
|
|
2098
|
+
hookScroll(): void;
|
|
2099
|
+
/** Unhook mousewheel / scroll event listeners */
|
|
2100
|
+
unhookScroll(): void;
|
|
2101
|
+
/** Hook touch/pinch event listeners */
|
|
2102
|
+
hookPinch(): void;
|
|
2103
|
+
/** Unhook touch/pinch event listeners */
|
|
2104
|
+
unhookPinch(): void;
|
|
2105
|
+
/** Hook mouse/touch dragging event listeners */
|
|
2106
|
+
hookDrag(): void;
|
|
2107
|
+
/** Unhook mouse/touch dragging event listeners */
|
|
2108
|
+
unhookDrag(): void;
|
|
2109
|
+
}
|
|
2110
|
+
/** Micrio sizing and `<canvas>` controller */
|
|
2111
|
+
export class Canvas {
|
|
2112
|
+
private micrio;
|
|
2113
|
+
/** The Micrio WebGL rendering `<canvas>` element */
|
|
2114
|
+
readonly element: HTMLCanvasElement;
|
|
2115
|
+
/** Canvas sizing information */
|
|
2116
|
+
readonly viewport: Models.Canvas.ViewRect;
|
|
2117
|
+
/** Client is a mobile device, Writable */
|
|
2118
|
+
readonly isMobile: Writable<boolean>;
|
|
2119
|
+
/** Client is a mobile device, Writable value */
|
|
2120
|
+
get $isMobile(): boolean;
|
|
2121
|
+
constructor(micrio: HTMLMicrioElement);
|
|
2122
|
+
/** Micrio element resize handler */
|
|
2123
|
+
onresize(): void;
|
|
2124
|
+
/** Get the screen pixel ratio
|
|
2125
|
+
* @returns The device pixel ratio
|
|
2126
|
+
*/
|
|
2127
|
+
getRatio: (s?: Partial<Models.ImageInfo.Settings>) => number;
|
|
2128
|
+
/** Set virtual offset margins applied to all viewports
|
|
2129
|
+
* @param width The offset width in pixels
|
|
2130
|
+
* @param height The offset height in pixels
|
|
2131
|
+
*/
|
|
2132
|
+
setMargins(width: number, height: number): void;
|
|
2133
|
+
}
|
|
2134
|
+
export const locale: string;
|
|
2135
|
+
export const languageNames: Intl.DisplayNames;
|
|
2136
|
+
export const rtlLanguageCodes: string[];
|
|
2137
|
+
interface ButtonTranslations {
|
|
2138
|
+
close: string;
|
|
2139
|
+
zoomIn: string;
|
|
2140
|
+
zoomOut: string;
|
|
2141
|
+
fullscreenToggle: string;
|
|
2142
|
+
switchLanguage: string;
|
|
2143
|
+
share: string;
|
|
2144
|
+
audioMute: string;
|
|
2145
|
+
audioUnmute: string;
|
|
2146
|
+
closeMarker: string;
|
|
2147
|
+
tourStepNext: string;
|
|
2148
|
+
tourStepPrev: string;
|
|
2149
|
+
tourStop: string;
|
|
2150
|
+
minimize: string;
|
|
2151
|
+
play: string;
|
|
2152
|
+
pause: string;
|
|
2153
|
+
stop: string;
|
|
2154
|
+
subtitlesToggle: string;
|
|
2155
|
+
galleryPrev: string;
|
|
2156
|
+
galleryNext: string;
|
|
2157
|
+
menuToggle: string;
|
|
2158
|
+
waypointFollow: string;
|
|
2159
|
+
}
|
|
2160
|
+
export const langs: {
|
|
2161
|
+
[key: string]: ButtonTranslations;
|
|
2162
|
+
};
|
|
2163
|
+
export const i18n: Writable<ButtonTranslations>;
|
|
2164
|
+
/**
|
|
2165
|
+
* [[include:./ts/element.md]]
|
|
2166
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
2167
|
+
* @copyright Q42 Internet BV, Micrio, 2015 - 2024
|
|
2168
|
+
* @link https://micr.io/ , https://q42.nl/en/
|
|
2169
|
+
*/
|
|
2170
|
+
export class HTMLMicrioElement extends HTMLElement {
|
|
2171
|
+
static get observedAttributes(): string[];
|
|
2172
|
+
/** The Micrio library version number */
|
|
2173
|
+
static VERSION: string;
|
|
2174
|
+
/** Downloaded JSON files cache store */
|
|
2175
|
+
static jsonCache: Map<string, Object>;
|
|
2176
|
+
/** All available canvases */
|
|
2177
|
+
readonly canvases: MicrioImage[];
|
|
2178
|
+
/** Current main {@link MicrioImage} store {@link SvelteStore.Writable}. Its value can be referred to using the {@link $current} property */
|
|
2179
|
+
readonly current: Writable<MicrioImage | undefined>;
|
|
2180
|
+
/** Currently visible canvases */
|
|
2181
|
+
readonly visible: Writable<MicrioImage[]>;
|
|
2182
|
+
/** The current active and shown {@link MicrioImage}, returning the current value of the {@link current} store {@link SvelteStore.Writable}
|
|
2183
|
+
* @readonly
|
|
2184
|
+
*/
|
|
2185
|
+
get $current(): MicrioImage | undefined;
|
|
2186
|
+
/** The virtual camera instance to control the current main image views */
|
|
2187
|
+
get camera(): Camera | undefined;
|
|
2188
|
+
/** The Micrio sizing and `<canvas>` controller */
|
|
2189
|
+
readonly canvas: Canvas;
|
|
2190
|
+
/** User input browser event handlers */
|
|
2191
|
+
readonly events: Events;
|
|
2192
|
+
/** The main state manager. Read more about it in the {@link State} section.*/
|
|
2193
|
+
readonly state: State.Main;
|
|
2194
|
+
/** Google analytics plugin */
|
|
2195
|
+
private readonly analytics;
|
|
2196
|
+
/** Router */
|
|
2197
|
+
private readonly _router;
|
|
2198
|
+
/** Barebone texture downloading, uglier but less bandwidth */
|
|
2199
|
+
readonly barebone: Writable<boolean>;
|
|
2200
|
+
/** Custom settings, if specified, this overwrites any server received data */
|
|
2201
|
+
defaultSettings?: Partial<Models.ImageInfo.Settings>;
|
|
2202
|
+
/** 360 tour Space data */
|
|
2203
|
+
spaceData: Models.Spaces.Space | undefined;
|
|
2204
|
+
/** Destroy the Micrio instance and free up all memory */
|
|
2205
|
+
destroy(): void;
|
|
2206
|
+
private printUI;
|
|
2207
|
+
/** Open a Micrio image by ID or {@link Models.ImageInfo.ImageInfo} JSON data
|
|
2208
|
+
* @param idOrInfo An image ID or a {@link Models.ImageInfo.ImageInfo} JSON object
|
|
2209
|
+
* @param opts Some opening parameters
|
|
2210
|
+
*/
|
|
2211
|
+
open(idOrInfo: string | Partial<Models.ImageInfo.ImageInfo>, opts?: {
|
|
2212
|
+
/** Don't focus on an image inside the grid, keep the grid active */
|
|
2213
|
+
gridView?: boolean;
|
|
2214
|
+
/** Open the image as a secondary split screen image */
|
|
2215
|
+
splitScreen?: boolean;
|
|
2216
|
+
/** Optional image that is the lead image for split screen */
|
|
2217
|
+
splitTo?: MicrioImage;
|
|
2218
|
+
/** Passive split screen */
|
|
2219
|
+
isPassive?: boolean;
|
|
2220
|
+
/** Optional start view */
|
|
2221
|
+
startView?: Models.Camera.View;
|
|
2222
|
+
/** In case of 360, move into this direction */
|
|
2223
|
+
vector?: Models.Camera.Vector;
|
|
2224
|
+
}): MicrioImage;
|
|
2225
|
+
/** Close an opened MicrioImage
|
|
2226
|
+
* @param img The currently visible {@link MicrioImage}
|
|
2227
|
+
*/
|
|
2228
|
+
close(img: MicrioImage): void;
|
|
2229
|
+
private loadGallery;
|
|
2230
|
+
gridInfoData: {
|
|
2231
|
+
images: Models.ImageInfo.ImageInfo[];
|
|
2232
|
+
} | undefined;
|
|
2233
|
+
private setGrid;
|
|
2234
|
+
private getArchiveIndex;
|
|
2235
|
+
}
|
|
2236
|
+
export class GoogleTag {
|
|
2237
|
+
private micrio;
|
|
2238
|
+
/** Google Tag Manager tracker
|
|
2239
|
+
* @param {!HTMLMicrioElement} micrio The Micrio instance
|
|
2240
|
+
*/
|
|
2241
|
+
constructor(micrio: HTMLMicrioElement);
|
|
2242
|
+
}
|
|
2243
|
+
/**
|
|
2244
|
+
* # Svelte stores in Micrio
|
|
2245
|
+
*
|
|
2246
|
+
* Micrio uses [Svelte Stores](https://svelte.dev/tutorial/writable-stores) for its internal state management.
|
|
2247
|
+
*
|
|
2248
|
+
* This means that changes in values can passively trigger state updates.
|
|
2249
|
+
*
|
|
2250
|
+
* There are two types of stores: {@link Readable}, which is read-only for the user, and {@link Writable} which can be updated or overridden by the user.
|
|
2251
|
+
*
|
|
2252
|
+
* Typically, for accessing the data directly instead of its store, Micrio offers `$` prefixes to any store properties:
|
|
2253
|
+
*
|
|
2254
|
+
* ```js
|
|
2255
|
+
* // This is the current active image in <micr-io> (.current is the store Writable)
|
|
2256
|
+
* const image = micrio.$current;
|
|
2257
|
+
*
|
|
2258
|
+
* // The current image ImageInfo value
|
|
2259
|
+
* const info = image.$info;
|
|
2260
|
+
*
|
|
2261
|
+
* // Log the current image resolution
|
|
2262
|
+
* console.log(`The current image is ${info.width} x ${info.height}px`);
|
|
2263
|
+
*
|
|
2264
|
+
* // The current CultureData value of the current MicrioImage
|
|
2265
|
+
* console.log(micrio.$current.$data);
|
|
2266
|
+
* ```
|
|
2267
|
+
*
|
|
2268
|
+
* An example of setting and subscribing to the {@link Micrio.MicrioImage.data} writable store:
|
|
2269
|
+
*
|
|
2270
|
+
* ```js
|
|
2271
|
+
*
|
|
2272
|
+
* // Subscribe to any changes in its data (markers, tours, etc)
|
|
2273
|
+
* image.data.subscribe(data => {
|
|
2274
|
+
* // Data for this image been set, removed or changed
|
|
2275
|
+
* // This also triggers when the image data has been loaded from the server
|
|
2276
|
+
* if(data) console.log(`The image now has ${data.markers.length} markers`);
|
|
2277
|
+
* else console.log('The image data is now empty.');
|
|
2278
|
+
* });
|
|
2279
|
+
*
|
|
2280
|
+
* // Let's set the image data to something. It expects ImageData.
|
|
2281
|
+
* image.data.set({
|
|
2282
|
+
* markers: [{
|
|
2283
|
+
* "title": "My First Marker",
|
|
2284
|
+
* "x": .5,
|
|
2285
|
+
* "y": .5
|
|
2286
|
+
* }]
|
|
2287
|
+
* });
|
|
2288
|
+
*
|
|
2289
|
+
* // Immediately access the data
|
|
2290
|
+
* console.log('The data has been set to', image.$data);
|
|
2291
|
+
* ```
|
|
2292
|
+
*
|
|
2293
|
+
* ## List of stores used by Micrio:
|
|
2294
|
+
|
|
2295
|
+
* | Property | Direct value getter | Type | Description |
|
|
2296
|
+
* | ----------- | ----------- | ------------- | ---- |
|
|
2297
|
+
* | **`<micr-io>` Element** |||
|
|
2298
|
+
* | .{@link Micrio.HTMLMicrioElement.current} | {@link Micrio.HTMLMicrioElement.$current} | {@link Writable}<{@link Micrio.MicrioImage}> | The current active and shown {@link Micrio.MicrioImage} |
|
|
2299
|
+
* | **`<micr-io>.state` controller** |||
|
|
2300
|
+
* | .{@link Micrio.State.Main.tour} | {@link Micrio.State.Main.$tour} | {@link Writable}<{@link Micrio.Models.ImageData.MarkerTour} | {@link Micrio.Models.ImageData.VideoTour}> | The current running VideoTour or MarkerTour |
|
|
2301
|
+
* | .{@link Micrio.State.Main.marker} | {@link Micrio.State.Main.$marker} | {@link Writable}<{@link Micrio.Models.ImageData.Marker}> | The current opened marker in the current opened {@link Micrio.MicrioImage} |
|
|
2302
|
+
* **Individual `MicrioImage`** |||
|
|
2303
|
+
* | .{@link Micrio.MicrioImage.info} | {@link Micrio.MicrioImage.$info} | {@link Readable}<{@link Micrio.Models.ImageInfo}> | The static image base info |
|
|
2304
|
+
* | .{@link Micrio.MicrioImage.data} | {@link Micrio.MicrioImage.$data} | {@link Writable}<{@link Micrio.Models.ImageData}> | The image data (markers, tours, etc) |
|
|
2305
|
+
* **`MicrioImage.state` controller** |||
|
|
2306
|
+
* | .{@link Micrio.State.Image.view} | {@link Micrio.State.Image.$view} | {@link Writable}<{@link Micrio.Models.Camera.View}> | The current viewport |
|
|
2307
|
+
* | .{@link Micrio.State.Main.marker} | {@link Micrio.State.Main.$marker} | {@link Writable}<{@link Micrio.Models.ImageData.Marker}> | The current opened marker of this image |
|
|
2308
|
+
*
|
|
2309
|
+
*
|
|
2310
|
+
* @category Svelte
|
|
2311
|
+
* @module SvelteStore
|
|
2312
|
+
* @package svelte
|
|
2313
|
+
* @author [These people](https://github.com/sveltejs/svelte/graphs/contributors)
|
|
2314
|
+
* @license MIT https://github.com/sveltejs/svelte/blob/master/LICENSE.md
|
|
2315
|
+
* @link https://svelte.dev/tutorial/writable-stores
|
|
2316
|
+
*/
|
|
2317
|
+
export * from 'svelte/store';
|
|
2318
|
+
}declare module "svelte/store" {
|
|
2319
|
+
/** Callback to inform of a value updates.
|
|
2320
|
+
*/
|
|
2321
|
+
export type Subscriber<T> = (value: T) => void;
|
|
2322
|
+
/** Unsubscribes from value updates.
|
|
2323
|
+
*/
|
|
2324
|
+
export type Unsubscriber = () => void;
|
|
2325
|
+
/** Callback to update a value.
|
|
2326
|
+
*/
|
|
2327
|
+
export type Updater<T> = (value: T) => T;
|
|
2328
|
+
/** Cleanup logic callback. */
|
|
2329
|
+
type Invalidator<T> = (value?: T) => void;
|
|
2330
|
+
/** Start and stop notification callbacks.
|
|
2331
|
+
* @internal
|
|
2332
|
+
*/
|
|
2333
|
+
export type StartStopNotifier<T> = (set: Subscriber<T>) => Unsubscriber | void;
|
|
2334
|
+
/** Readable interface for subscribing. See the main {@link SvelteStore} article on how to use it in Micrio. */
|
|
2335
|
+
export interface Readable<T> {
|
|
2336
|
+
/**
|
|
2337
|
+
* Subscribe on value changes.
|
|
2338
|
+
* @param run subscription callback
|
|
2339
|
+
* @param invalidate cleanup callback
|
|
2340
|
+
*/
|
|
2341
|
+
subscribe(this: void, run: Subscriber<T>, invalidate?: Invalidator<T>): Unsubscriber;
|
|
2342
|
+
}
|
|
2343
|
+
/** Writable interface for both updating and subscribing. See the main {@link SvelteStore} article on how to use it in Micrio. */
|
|
2344
|
+
export interface Writable<T> extends Readable<T> {
|
|
2345
|
+
/**
|
|
2346
|
+
* Set value and inform subscribers.
|
|
2347
|
+
* @param value to set
|
|
2348
|
+
*/
|
|
2349
|
+
set(this: void, value: T): void;
|
|
2350
|
+
/**
|
|
2351
|
+
* Update value using callback and inform subscribers.
|
|
2352
|
+
* @param updater callback
|
|
2353
|
+
*/
|
|
2354
|
+
update(this: void, updater: Updater<T>): void;
|
|
2355
|
+
}
|
|
2356
|
+
/**
|
|
2357
|
+
* Creates a `Readable` store that allows reading by subscription.
|
|
2358
|
+
* @internal
|
|
2359
|
+
* @param value initial value
|
|
2360
|
+
* @param {StartStopNotifier}start start and stop notifications for subscriptions
|
|
2361
|
+
*/
|
|
2362
|
+
export function readable<T>(value?: T, start?: StartStopNotifier<T>): Readable<T>;
|
|
2363
|
+
/**
|
|
2364
|
+
* Create a `Writable` store that allows both updating and reading by subscription.
|
|
2365
|
+
* @internal
|
|
2366
|
+
* @param {*=}value initial value
|
|
2367
|
+
* @param {StartStopNotifier=}start start and stop notifications for subscriptions
|
|
2368
|
+
*/
|
|
2369
|
+
export function writable<T>(value?: T, start?: StartStopNotifier<T>): Writable<T>;
|
|
2370
|
+
/** One or more `Readable`s.
|
|
2371
|
+
* @internal
|
|
2372
|
+
*/
|
|
2373
|
+
type Stores = Readable<any> | [Readable<any>, ...Array<Readable<any>>] | Array<Readable<any>>;
|
|
2374
|
+
/** One or more values from `Readable` stores.
|
|
2375
|
+
* @internal
|
|
2376
|
+
*/
|
|
2377
|
+
type StoresValues<T> = T extends Readable<infer U> ? U : {
|
|
2378
|
+
[K in keyof T]: T[K] extends Readable<infer U> ? U : never;
|
|
2379
|
+
};
|
|
2380
|
+
/**
|
|
2381
|
+
* Derived value store by synchronizing one or more readable stores and
|
|
2382
|
+
* applying an aggregation function over its input values.
|
|
2383
|
+
*
|
|
2384
|
+
* @internal
|
|
2385
|
+
* @param stores - input stores
|
|
2386
|
+
* @param fn - function callback that aggregates the values
|
|
2387
|
+
* @param initial_value - when used asynchronously
|
|
2388
|
+
*/
|
|
2389
|
+
export function derived<S extends Stores, T>(stores: S, fn: (values: StoresValues<S>, set: (value: T) => void) => Unsubscriber | void, initial_value?: T): Readable<T>;
|
|
2390
|
+
/**
|
|
2391
|
+
* Derived value store by synchronizing one or more readable stores and
|
|
2392
|
+
* applying an aggregation function over its input values.
|
|
2393
|
+
*
|
|
2394
|
+
* @internal
|
|
2395
|
+
* @param stores - input stores
|
|
2396
|
+
* @param fn - function callback that aggregates the values
|
|
2397
|
+
* @param initial_value - initial value
|
|
2398
|
+
*/
|
|
2399
|
+
export function derived<S extends Stores, T>(stores: S, fn: (values: StoresValues<S>) => T, initial_value?: T): Readable<T>;
|
|
2400
|
+
/**
|
|
2401
|
+
* Derived value store by synchronizing one or more readable stores and
|
|
2402
|
+
* applying an aggregation function over its input values.
|
|
2403
|
+
*
|
|
2404
|
+
* @internal
|
|
2405
|
+
* @param stores - input stores
|
|
2406
|
+
* @param fn - function callback that aggregates the values
|
|
2407
|
+
*/
|
|
2408
|
+
export function derived<S extends Stores, T>(stores: S, fn: (values: StoresValues<S>) => T): Readable<T>;
|
|
2409
|
+
/**
|
|
2410
|
+
* Get the current value from a store by subscribing and immediately unsubscribing.
|
|
2411
|
+
* @internal
|
|
2412
|
+
* @param store readable
|
|
2413
|
+
*/
|
|
2414
|
+
export function get<T>(store: Readable<T>): T;
|
|
2415
|
+
|
|
2416
|
+
}
|