kritzel-stencil 0.3.12 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-CFnj_FXt.js → index-Xav9JFHg.js} +1 -1
- package/dist/cjs/index.cjs.js +41 -3
- package/dist/cjs/kritzel-active-users_42.cjs.entry.js +281 -113
- package/dist/cjs/kritzel-brush-style.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{schema.constants-CzfoUWxF.js → schema.constants-DJQTjcy7.js} +84 -42
- package/dist/cjs/stencil.cjs.js +3 -3
- package/dist/collection/classes/core/viewport.class.js +97 -8
- package/dist/collection/classes/objects/image.class.js +62 -0
- package/dist/collection/classes/objects/shape.class.js +2 -1
- package/dist/collection/classes/tools/base-tool.class.js +2 -0
- package/dist/collection/classes/tools/brush-tool.class.js +1 -0
- package/dist/collection/classes/tools/eraser-tool.class.js +1 -0
- package/dist/collection/classes/tools/image-tool.class.js +1 -0
- package/dist/collection/classes/tools/line-tool.class.js +1 -0
- package/dist/collection/classes/tools/selection-tool.class.js +1 -0
- package/dist/collection/classes/tools/shape-tool.class.js +1 -0
- package/dist/collection/classes/tools/text-tool.class.js +1 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +156 -33
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +270 -19
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.css +3 -3
- package/dist/collection/components/shared/kritzel-input/kritzel-input.css +1 -1
- package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.css +2 -2
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.css +7 -0
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +7 -1
- package/dist/collection/components/ui/kritzel-export/kritzel-export.css +1 -1
- package/dist/collection/components/ui/kritzel-tool-config/kritzel-tool-config.js +2 -2
- package/dist/collection/configs/default-asset-storage.config.js +1 -2
- package/dist/collection/configs/default-sync.config.js +2 -5
- package/dist/collection/constants/version.js +1 -1
- package/dist/collection/helpers/tool-config.helper.js +58 -65
- package/dist/collection/interfaces/tool-type.interface.js +1 -0
- package/dist/collection/themes/dark-theme.js +5 -0
- package/dist/collection/themes/light-theme.js +5 -0
- package/dist/components/index.js +1 -1
- package/dist/components/kritzel-active-users.js +1 -1
- package/dist/components/kritzel-avatar.js +1 -1
- package/dist/components/kritzel-awareness-cursors.js +1 -1
- package/dist/components/kritzel-back-to-content.js +1 -1
- package/dist/components/kritzel-brush-style.js +1 -1
- package/dist/components/kritzel-button.js +1 -1
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-color.js +1 -1
- package/dist/components/kritzel-context-menu.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-current-user-dialog.js +1 -1
- package/dist/components/kritzel-current-user.js +1 -1
- package/dist/components/kritzel-cursor-trail.js +1 -1
- package/dist/components/kritzel-dialog.js +1 -1
- package/dist/components/kritzel-dropdown.js +1 -1
- package/dist/components/kritzel-editor.js +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-export.js +1 -1
- package/dist/components/kritzel-font-family.js +1 -1
- package/dist/components/kritzel-font-size.js +1 -1
- package/dist/components/kritzel-font.js +1 -1
- package/dist/components/kritzel-icon.js +1 -1
- package/dist/components/kritzel-input.js +1 -1
- package/dist/components/kritzel-line-endings.js +1 -1
- package/dist/components/kritzel-login-dialog.js +1 -1
- package/dist/components/kritzel-master-detail.js +1 -1
- package/dist/components/kritzel-menu-item.js +1 -1
- package/dist/components/kritzel-menu.js +1 -1
- package/dist/components/kritzel-more-menu.js +1 -1
- package/dist/components/kritzel-numeric-input.js +1 -1
- package/dist/components/kritzel-opacity-slider.js +1 -1
- package/dist/components/kritzel-pill-tabs.js +1 -1
- package/dist/components/kritzel-portal.js +1 -1
- package/dist/components/kritzel-settings.js +1 -1
- package/dist/components/kritzel-shape-fill.js +1 -1
- package/dist/components/kritzel-share-dialog.js +1 -1
- package/dist/components/kritzel-slide-toggle.js +1 -1
- package/dist/components/kritzel-split-button.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tool-config.js +1 -1
- package/dist/components/kritzel-tooltip.js +1 -1
- package/dist/components/kritzel-utility-panel.js +1 -1
- package/dist/components/kritzel-workspace-manager.js +1 -1
- package/dist/components/p-2xYAGd0I.js +1 -0
- package/dist/components/{p-DdmJquQr.js → p-B2Os1ya_.js} +1 -1
- package/dist/components/p-B2w8X7vn.js +1 -0
- package/dist/components/{p-DRB3TZzI.js → p-B4b6TDxp.js} +1 -1
- package/dist/components/p-B5xxfwKF.js +1 -0
- package/dist/components/{p-D0aom7Yu.js → p-BFYtCsZu.js} +1 -1
- package/dist/components/{p-CARNM9pf.js → p-BFoK4W--.js} +1 -1
- package/dist/components/p-BTEV1WwT.js +1 -0
- package/dist/components/{p-x38RbGJA.js → p-BYmp9Ovv.js} +1 -1
- package/dist/components/{p-KVG5rztB.js → p-BbactVA0.js} +1 -1
- package/dist/components/{p-B_JH91jB.js → p-BfNHpqQ8.js} +1 -1
- package/dist/components/{p-DXgUuzXW.js → p-BiG1dxPS.js} +1 -1
- package/dist/components/{p-Dov3qOAR.js → p-Bj2laX89.js} +1 -1
- package/dist/components/{p-Cr7xOsIZ.js → p-BqwqGFQY.js} +1 -1
- package/dist/components/{p-DmTG0Y5h.js → p-BzYU3-MJ.js} +1 -1
- package/dist/components/p-C0TN5IAi.js +1 -0
- package/dist/components/{p-RnuCSIt-.js → p-C2SX-XRr.js} +1 -1
- package/dist/components/{p-guqEWGgV.js → p-CFgkUYoO.js} +1 -1
- package/dist/components/{p-BTSOqHMI.js → p-CHrSFOSI.js} +1 -1
- package/dist/components/p-CJOhfMU5.js +1 -0
- package/dist/components/p-CLLbE_z8.js +9 -0
- package/dist/components/{p-DJLJfKY2.js → p-COLHjboZ.js} +1 -1
- package/dist/components/{p-CKY7AvGR.js → p-COgo9OWy.js} +1 -1
- package/dist/components/p-CUPYGT8c.js +1 -0
- package/dist/components/{p-DhAM4qeQ.js → p-CXpv9Rxe.js} +1 -1
- package/dist/components/{p-Bp3kdH4l.js → p-CcyIAi9S.js} +1 -1
- package/dist/components/{p-COIxq81R.js → p-CmuNn1Tc.js} +1 -1
- package/dist/components/{p-DfH7YY2C.js → p-D-sRVAbQ.js} +1 -1
- package/dist/components/{p-ZgZqbJ58.js → p-DDYoDSrm.js} +1 -1
- package/dist/components/{p-u0b2RJAn.js → p-DEy7zJCe.js} +1 -1
- package/dist/components/{p-BPEn0_hr.js → p-DM11KXUT.js} +1 -1
- package/dist/components/{p-CJERvHdy.js → p-DbB730vO.js} +1 -1
- package/dist/components/{p-C8ggg-5h.js → p-Df3BwVGy.js} +1 -1
- package/dist/components/{p-EFyZdR89.js → p-DkaiWg1V.js} +1 -1
- package/dist/components/{p-Dx_xz_El.js → p-DlwYHzSj.js} +1 -1
- package/dist/components/{p-CJ2V42sz.js → p-FK7b3BGt.js} +1 -1
- package/dist/components/{p-Do4UlU4e.js → p-J9_SwObO.js} +1 -1
- package/dist/components/{p-CxtTuKCy.js → p-JhOYwUOj.js} +1 -1
- package/dist/components/{p-Dw9sKOsb.js → p-SptaSMno.js} +1 -1
- package/dist/components/{p-KjtNlFTl.js → p-UoPj5QjH.js} +1 -1
- package/dist/components/{p-CYR9wbJg.js → p-dcAernE1.js} +1 -1
- package/dist/components/{p-BI_UUiTr.js → p-skWUIStn.js} +1 -1
- package/dist/components/{p-DgtrNOWm.js → p-x6doYeiI.js} +1 -1
- package/dist/esm/{index-D9HaikfQ.js → index-Dhio9uis.js} +1 -1
- package/dist/esm/index.js +42 -4
- package/dist/esm/kritzel-active-users_42.entry.js +281 -113
- package/dist/esm/kritzel-brush-style.entry.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{schema.constants-BcT1vV4J.js → schema.constants-DiCnmIYK.js} +85 -42
- package/dist/esm/stencil.js +4 -4
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-DiCnmIYK.js +1 -0
- package/dist/stencil/p-ea76b21f.entry.js +9 -0
- package/dist/stencil/{p-69298b5f.entry.js → p-fb32cd8f.entry.js} +1 -1
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/core/viewport.class.d.ts +38 -0
- package/dist/types/classes/objects/image.class.d.ts +15 -0
- package/dist/types/classes/tools/base-tool.class.d.ts +3 -0
- package/dist/types/classes/tools/brush-tool.class.d.ts +1 -0
- package/dist/types/classes/tools/eraser-tool.class.d.ts +1 -0
- package/dist/types/classes/tools/image-tool.class.d.ts +1 -0
- package/dist/types/classes/tools/line-tool.class.d.ts +1 -0
- package/dist/types/classes/tools/selection-tool.class.d.ts +1 -0
- package/dist/types/classes/tools/shape-tool.class.d.ts +1 -0
- package/dist/types/classes/tools/text-tool.class.d.ts +1 -0
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +13 -3
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +49 -5
- package/dist/types/components/ui/kritzel-context-menu/kritzel-context-menu.d.ts +1 -0
- package/dist/types/components.d.ts +54 -20
- package/dist/types/configs/default-asset-storage.config.d.ts +1 -1
- package/dist/types/configs/default-sync.config.d.ts +1 -1
- package/dist/types/constants/version.d.ts +1 -1
- package/dist/types/interfaces/theme.interface.d.ts +8 -3
- package/dist/types/interfaces/tool-config.interface.d.ts +3 -6
- package/dist/types/interfaces/tool-type.interface.d.ts +1 -0
- package/dist/types/interfaces/tool.interface.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-C0wFAtT_.js +0 -1
- package/dist/components/p-CWgI1dA0.js +0 -1
- package/dist/components/p-DH-H7om7.js +0 -1
- package/dist/components/p-DIiGd0LS.js +0 -1
- package/dist/components/p-DLh8x1jK.js +0 -9
- package/dist/components/p-Dqjil3Hm.js +0 -1
- package/dist/components/p-IiG44Unz.js +0 -1
- package/dist/components/p-K7ySy791.js +0 -1
- package/dist/stencil/p-0c95e585.entry.js +0 -9
- package/dist/stencil/p-BcT1vV4J.js +0 -1
- /package/dist/components/{p-BWj1eE2b.js → p-B43upypT.js} +0 -0
- /package/dist/stencil/{p-D9HaikfQ.js → p-Dhio9uis.js} +0 -0
|
@@ -395,6 +395,87 @@ export class KritzelViewport {
|
|
|
395
395
|
this.setViewport(centerWorldX, centerWorldY, scale);
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Zooms in by a fixed step, centered on the current viewport center,
|
|
400
|
+
* with a smooth animation. The resulting scale is clamped to the allowed range.
|
|
401
|
+
* @param factor - Multiplicative zoom-in step
|
|
402
|
+
* @param duration - Animation duration in milliseconds
|
|
403
|
+
*/
|
|
404
|
+
zoomIn(factor, duration) {
|
|
405
|
+
this.animateZoomAroundViewportCenter(factor, duration);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Zooms out by a fixed step, centered on the current viewport center,
|
|
409
|
+
* with a smooth animation. The resulting scale is clamped to the allowed range.
|
|
410
|
+
* @param factor - Multiplicative zoom-out step
|
|
411
|
+
* @param duration - Animation duration in milliseconds
|
|
412
|
+
*/
|
|
413
|
+
zoomOut(factor, duration) {
|
|
414
|
+
this.animateZoomAroundViewportCenter(1 / factor, duration);
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Smoothly zooms around the viewport center, keeping the center world point
|
|
418
|
+
* fixed for the entire animation. The translation is recomputed from the fixed
|
|
419
|
+
* center point on every frame (rather than interpolated independently), which
|
|
420
|
+
* guarantees the center never drifts and the viewport does not jump.
|
|
421
|
+
* The resulting scale is clamped to the allowed range and the translation is
|
|
422
|
+
* clamped to the viewport boundaries.
|
|
423
|
+
* @param scaleFactor - Multiplicative scale factor (>1 zooms in, <1 zooms out)
|
|
424
|
+
* @param duration - Animation duration in milliseconds
|
|
425
|
+
*/
|
|
426
|
+
animateZoomAroundViewportCenter(scaleFactor, duration) {
|
|
427
|
+
this.cancelViewportAnimation();
|
|
428
|
+
const state = this._core.store.state;
|
|
429
|
+
const startScale = state.scale;
|
|
430
|
+
const effectiveMinScale = this.getEffectiveMinScale();
|
|
431
|
+
const targetScale = Math.min(state.scaleMax, Math.max(effectiveMinScale, startScale * scaleFactor));
|
|
432
|
+
// The world point currently under the viewport center stays fixed.
|
|
433
|
+
const centerScreenX = state.viewportWidth / 2;
|
|
434
|
+
const centerScreenY = state.viewportHeight / 2;
|
|
435
|
+
const centerWorldX = (centerScreenX - state.translateX) / startScale;
|
|
436
|
+
const centerWorldY = (centerScreenY - state.translateY) / startScale;
|
|
437
|
+
if (targetScale === startScale || duration <= 0) {
|
|
438
|
+
this.applyZoomAroundCenter(targetScale, centerScreenX, centerScreenY, centerWorldX, centerWorldY);
|
|
439
|
+
state.isScaling = true;
|
|
440
|
+
this._core.rerender();
|
|
441
|
+
this._debounceUpdate();
|
|
442
|
+
this._debounceEndScaling();
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
const startTime = performance.now();
|
|
446
|
+
state.isScaling = true;
|
|
447
|
+
const animate = (currentTime) => {
|
|
448
|
+
const elapsed = currentTime - startTime;
|
|
449
|
+
const progress = Math.min(elapsed / duration, 1);
|
|
450
|
+
// easeInOutCubic for a smooth ramp in and out
|
|
451
|
+
const eased = progress < 0.5 ? 4 * progress * progress * progress : 1 - Math.pow(-2 * progress + 2, 3) / 2;
|
|
452
|
+
const frameScale = startScale + (targetScale - startScale) * eased;
|
|
453
|
+
this.applyZoomAroundCenter(frameScale, centerScreenX, centerScreenY, centerWorldX, centerWorldY);
|
|
454
|
+
this._core.rerender();
|
|
455
|
+
if (progress < 1) {
|
|
456
|
+
this._animationFrameId = requestAnimationFrame(animate);
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
this._animationFrameId = null;
|
|
460
|
+
state.isScaling = false;
|
|
461
|
+
this._core.rerender();
|
|
462
|
+
this._debounceUpdate();
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
this._animationFrameId = requestAnimationFrame(animate);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Applies a single zoom step that keeps the given world point anchored to the
|
|
469
|
+
* given screen point at the specified scale, clamped to the viewport boundaries.
|
|
470
|
+
*/
|
|
471
|
+
applyZoomAroundCenter(scale, screenX, screenY, worldX, worldY) {
|
|
472
|
+
const state = this._core.store.state;
|
|
473
|
+
state.scale = scale;
|
|
474
|
+
const clamped = this.clampTranslate(screenX - worldX * scale, screenY - worldY * scale);
|
|
475
|
+
state.translateX = clamped.translateX;
|
|
476
|
+
state.translateY = clamped.translateY;
|
|
477
|
+
state.hasViewportChanged = true;
|
|
478
|
+
}
|
|
398
479
|
/**
|
|
399
480
|
* Centers a given object in the viewport without changing the scale.
|
|
400
481
|
* The object's center point will be positioned at the viewport center.
|
|
@@ -651,22 +732,21 @@ export class KritzelViewport {
|
|
|
651
732
|
return true;
|
|
652
733
|
}
|
|
653
734
|
/**
|
|
654
|
-
* Centers and fits
|
|
655
|
-
* Calculates the combined bounding box of
|
|
735
|
+
* Centers and fits the provided objects in the viewport.
|
|
736
|
+
* Calculates the combined bounding box of the provided objects and optionally animates the viewport to show them.
|
|
737
|
+
* @param objects - Objects to include in the fit operation.
|
|
656
738
|
* @param animate - Whether to animate the viewport transition (default: true)
|
|
657
|
-
* @returns true if
|
|
739
|
+
* @returns true if at least one object was provided and viewport was adjusted, false otherwise
|
|
658
740
|
*/
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
if (allObjects.length === 0) {
|
|
741
|
+
centerFitObjects(objects, animate = true) {
|
|
742
|
+
if (objects.length === 0) {
|
|
662
743
|
return false;
|
|
663
744
|
}
|
|
664
|
-
// Calculate combined bounds of all objects
|
|
665
745
|
let minX = Infinity;
|
|
666
746
|
let minY = Infinity;
|
|
667
747
|
let maxX = -Infinity;
|
|
668
748
|
let maxY = -Infinity;
|
|
669
|
-
for (const obj of
|
|
749
|
+
for (const obj of objects) {
|
|
670
750
|
const bounds = obj.rotatedBoundingBox;
|
|
671
751
|
minX = Math.min(minX, bounds.x);
|
|
672
752
|
minY = Math.min(minY, bounds.y);
|
|
@@ -689,4 +769,13 @@ export class KritzelViewport {
|
|
|
689
769
|
this.animateViewportTo(targetTranslateX, targetTranslateY, clampedScale, animate ? 150 : 0);
|
|
690
770
|
return true;
|
|
691
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* Centers and fits ALL objects in the viewport, including objects not currently rendered.
|
|
774
|
+
* Calculates the combined bounding box of all objects and optionally animates the viewport to show them.
|
|
775
|
+
* @param animate - Whether to animate the viewport transition (default: true)
|
|
776
|
+
* @returns true if objects were found and viewport was adjusted, false if no objects exist
|
|
777
|
+
*/
|
|
778
|
+
centerFitAllObjects(animate = true) {
|
|
779
|
+
return this.centerFitObjects(this._core.store.allNonSelectionObjects, animate);
|
|
780
|
+
}
|
|
692
781
|
}
|
|
@@ -328,6 +328,68 @@ export class KritzelImage extends KritzelBaseObject {
|
|
|
328
328
|
this.migrateLegacyDataUrlIfNeeded();
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Prepares image objects for insertion into the canvas while preserving
|
|
333
|
+
* the standard object-first flow (`new KritzelImage(...); addObject(image)`).
|
|
334
|
+
*
|
|
335
|
+
* Behavior:
|
|
336
|
+
* - If `assetId` is already set, no-op.
|
|
337
|
+
* - If `src` is set (URL or data URL), uploads bytes through the asset
|
|
338
|
+
* resolver, fills `assetId`/`mimeType`, computes dimensions when needed,
|
|
339
|
+
* and seeds `resolvedSrc` for immediate rendering.
|
|
340
|
+
*/
|
|
341
|
+
async prepareForInsert() {
|
|
342
|
+
if (this.assetId || !this.src) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (!this._core?.assetResolver) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const source = this.src;
|
|
349
|
+
const response = await fetch(source);
|
|
350
|
+
if (!response.ok) {
|
|
351
|
+
throw new Error(`Failed to load image source: ${source} (HTTP ${response.status})`);
|
|
352
|
+
}
|
|
353
|
+
const blob = await response.blob();
|
|
354
|
+
const mimeType = blob.type || 'image/png';
|
|
355
|
+
const { naturalWidth, naturalHeight } = await this.measureImageBlob(blob);
|
|
356
|
+
const asset = await this._core.assetResolver.put(blob, {
|
|
357
|
+
mimeType,
|
|
358
|
+
kind: 'image',
|
|
359
|
+
width: naturalWidth,
|
|
360
|
+
height: naturalHeight,
|
|
361
|
+
});
|
|
362
|
+
this.assetId = asset.id;
|
|
363
|
+
this.mimeType = asset.mimeType;
|
|
364
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
365
|
+
const { scaledWidth, scaledHeight } = this.calculateScaledDimensions({
|
|
366
|
+
width: naturalWidth,
|
|
367
|
+
height: naturalHeight,
|
|
368
|
+
});
|
|
369
|
+
this.width = scaledWidth;
|
|
370
|
+
this.height = scaledHeight;
|
|
371
|
+
}
|
|
372
|
+
this.resolvedSrc = await this._core.assetResolver.resolve(asset.id);
|
|
373
|
+
this.loadState = 'ready';
|
|
374
|
+
this.src = '';
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Measures intrinsic image dimensions from a Blob.
|
|
378
|
+
*/
|
|
379
|
+
async measureImageBlob(blob) {
|
|
380
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
381
|
+
try {
|
|
382
|
+
return await new Promise((resolve, reject) => {
|
|
383
|
+
const img = new Image();
|
|
384
|
+
img.onload = () => resolve({ naturalWidth: img.naturalWidth, naturalHeight: img.naturalHeight });
|
|
385
|
+
img.onerror = err => reject(err);
|
|
386
|
+
img.src = objectUrl;
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
finally {
|
|
390
|
+
URL.revokeObjectURL(objectUrl);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
331
393
|
/**
|
|
332
394
|
* Overrides base mount to kick off asset resolution the first time
|
|
333
395
|
* the image is attached to the DOM. Legacy images persisted with an
|
|
@@ -68,6 +68,8 @@ export class KritzelShape extends KritzelBaseObject {
|
|
|
68
68
|
*/
|
|
69
69
|
constructor(config) {
|
|
70
70
|
super();
|
|
71
|
+
// Always create the editor so setContent() works immediately
|
|
72
|
+
this.editor = this.createEditor();
|
|
71
73
|
if (config) {
|
|
72
74
|
this.x = config.x ?? 0;
|
|
73
75
|
this.y = config.y ?? 0;
|
|
@@ -118,7 +120,6 @@ export class KritzelShape extends KritzelBaseObject {
|
|
|
118
120
|
object.scaleFactor = 1;
|
|
119
121
|
object.scale = config?.scale ?? core.store.state.scale;
|
|
120
122
|
object.zIndex = core.store.currentZIndex;
|
|
121
|
-
object.editor = object.createEditor();
|
|
122
123
|
// Compute world-space translateX/Y from screen-space coordinates
|
|
123
124
|
// This follows the same pattern as KritzelPath.updateDimensions()
|
|
124
125
|
object.updateDimensions();
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
export class KritzelBaseTool {
|
|
7
7
|
/** Class name identifier used for serialization/deserialization */
|
|
8
8
|
__class__ = this.constructor.name;
|
|
9
|
+
/** Identifies the tool type for config resolution (survives minification and dual-package bundling) */
|
|
10
|
+
toolType = 'base';
|
|
9
11
|
/** Human-readable name of the tool */
|
|
10
12
|
name = 'base-tool';
|
|
11
13
|
/** Reference to the Kritzel core instance for accessing store, viewport, and other core functionality */
|
|
@@ -9,6 +9,7 @@ import { DEFAULT_STROKE_SIZES } from "../../constants/stroke-size.constants";
|
|
|
9
9
|
* Supports mouse, touch, and pen input with configurable color, size, and opacity.
|
|
10
10
|
*/
|
|
11
11
|
export class KritzelBrushTool extends KritzelBaseTool {
|
|
12
|
+
toolType = 'brush';
|
|
12
13
|
/** The color of the brush stroke (supports theme-aware light/dark colors) */
|
|
13
14
|
color = DEFAULT_COLOR_PALETTE[0];
|
|
14
15
|
/** The width of the brush stroke in pixels */
|
|
@@ -6,6 +6,7 @@ import { KritzelBaseTool } from "./base-tool.class";
|
|
|
6
6
|
* and deleted when the gesture completes. Supports mouse, touch, and pen input.
|
|
7
7
|
*/
|
|
8
8
|
export class KritzelEraserTool extends KritzelBaseTool {
|
|
9
|
+
toolType = 'eraser';
|
|
9
10
|
/** Timeout handle for delayed touch start activation to prevent accidental erasing */
|
|
10
11
|
touchStartTimeout = null;
|
|
11
12
|
/**
|
|
@@ -15,6 +15,7 @@ import imageCompression from "browser-image-compression";
|
|
|
15
15
|
* the id to a URL via the asset resolver.
|
|
16
16
|
*/
|
|
17
17
|
export class KritzelImageTool extends KritzelBaseTool {
|
|
18
|
+
toolType = 'image';
|
|
18
19
|
/** Hidden file input element for image selection */
|
|
19
20
|
fileInput = null;
|
|
20
21
|
/** Maximum dimension (width or height) for image compression in pixels */
|
|
@@ -11,6 +11,7 @@ import { DEFAULT_STROKE_SIZES } from "../../constants/stroke-size.constants";
|
|
|
11
11
|
* Automatically switches to selection tool after line completion.
|
|
12
12
|
*/
|
|
13
13
|
export class KritzelLineTool extends KritzelBaseTool {
|
|
14
|
+
toolType = 'line';
|
|
14
15
|
/** The stroke color of the line (supports theme-aware light/dark colors) */
|
|
15
16
|
color = DEFAULT_COLOR_PALETTE[0];
|
|
16
17
|
/** The stroke width of the line in pixels */
|
|
@@ -22,6 +22,7 @@ import { DEFAULT_COLOR_PALETTE } from "../../constants/color-palette.constants";
|
|
|
22
22
|
* to specialized handlers (selection, move, resize, rotation, hover, line handle).
|
|
23
23
|
*/
|
|
24
24
|
export class KritzelSelectionTool extends KritzelBaseTool {
|
|
25
|
+
toolType = 'selection';
|
|
25
26
|
/** Handler for selection box and object selection logic */
|
|
26
27
|
selectionHandler;
|
|
27
28
|
/** Handler for moving selected objects */
|
|
@@ -11,6 +11,7 @@ import { DEFAULT_STROKE_SIZES } from "../../constants/stroke-size.constants";
|
|
|
11
11
|
* Automatically switches to selection tool after shape completion.
|
|
12
12
|
*/
|
|
13
13
|
export class KritzelShapeTool extends KritzelBaseTool {
|
|
14
|
+
toolType = 'shape';
|
|
14
15
|
/** The type of shape to create (rectangle, ellipse, etc.) */
|
|
15
16
|
shapeType = ShapeType.Rectangle;
|
|
16
17
|
/** The fill color of the shape (supports theme-aware light/dark colors) */
|
|
@@ -10,6 +10,7 @@ import { DEFAULT_FONT_SIZES } from "../../constants/stroke-size.constants";
|
|
|
10
10
|
* Supports configurable font family, size, color, and opacity.
|
|
11
11
|
*/
|
|
12
12
|
export class KritzelTextTool extends KritzelBaseTool {
|
|
13
|
+
toolType = 'text';
|
|
13
14
|
/** Backing field for {@link fontFamily}. */
|
|
14
15
|
_fontFamily = 'Arial';
|
|
15
16
|
/** Backing field for {@link fontSize}. */
|
|
@@ -194,15 +194,7 @@ export class KritzelEditor {
|
|
|
194
194
|
/** The element to use as the target for the cursor. Defaults to the editor container if not set. */
|
|
195
195
|
cursorTarget;
|
|
196
196
|
/** Optional login configuration. When provided, a "Sign in" button is shown that opens a login dialog with the configured providers. */
|
|
197
|
-
loginConfig
|
|
198
|
-
providers: [
|
|
199
|
-
{
|
|
200
|
-
label: 'Sign in with Google',
|
|
201
|
-
icon: 'google',
|
|
202
|
-
name: 'Google',
|
|
203
|
-
},
|
|
204
|
-
],
|
|
205
|
-
};
|
|
197
|
+
loginConfig;
|
|
206
198
|
/** Whether the editor is in a loading state. When true, a loading overlay is displayed. */
|
|
207
199
|
isLoading = false;
|
|
208
200
|
/** Optional unique identifier for namespacing storage keys across multiple editor instances. */
|
|
@@ -331,12 +323,18 @@ export class KritzelEditor {
|
|
|
331
323
|
async centerObjectInViewport(object) {
|
|
332
324
|
return this.engineRef.centerObjectInViewport(object);
|
|
333
325
|
}
|
|
326
|
+
async panToObject(object) {
|
|
327
|
+
return this.engineRef.panToObject(object);
|
|
328
|
+
}
|
|
334
329
|
async backToContent() {
|
|
335
330
|
return this.engineRef.backToContent();
|
|
336
331
|
}
|
|
337
332
|
async centerAllObjects(animate = true) {
|
|
338
333
|
return this.engineRef.centerAllObjects(animate);
|
|
339
334
|
}
|
|
335
|
+
async centerObjects(objects, animate = true) {
|
|
336
|
+
return this.engineRef.centerObjects(objects, animate);
|
|
337
|
+
}
|
|
340
338
|
async setViewport(x, y, scale) {
|
|
341
339
|
return this.engineRef.setViewport(x, y, scale);
|
|
342
340
|
}
|
|
@@ -346,6 +344,12 @@ export class KritzelEditor {
|
|
|
346
344
|
async zoomTo(scale, worldX, worldY) {
|
|
347
345
|
return this.engineRef.zoomTo(scale, worldX, worldY);
|
|
348
346
|
}
|
|
347
|
+
async zoomIn(factor = 1.6, duration = 200) {
|
|
348
|
+
return this.engineRef.zoomIn(factor, duration);
|
|
349
|
+
}
|
|
350
|
+
async zoomOut(factor = 1.6, duration = 200) {
|
|
351
|
+
return this.engineRef.zoomOut(factor, duration);
|
|
352
|
+
}
|
|
349
353
|
async getViewport() {
|
|
350
354
|
return this.engineRef.getViewport();
|
|
351
355
|
}
|
|
@@ -431,14 +435,14 @@ export class KritzelEditor {
|
|
|
431
435
|
async redo() {
|
|
432
436
|
return this.engineRef.redo();
|
|
433
437
|
}
|
|
434
|
-
async getScreenshot(format = 'png') {
|
|
435
|
-
return this.engineRef.getScreenshot(format);
|
|
438
|
+
async getScreenshot(format = 'png', options) {
|
|
439
|
+
return this.engineRef.getScreenshot(format, options);
|
|
436
440
|
}
|
|
437
|
-
async exportViewportAsPng() {
|
|
438
|
-
return this.engineRef.exportViewportAsPng();
|
|
441
|
+
async exportViewportAsPng(options) {
|
|
442
|
+
return this.engineRef.exportViewportAsPng(options);
|
|
439
443
|
}
|
|
440
|
-
async exportViewportAsSvg() {
|
|
441
|
-
return this.engineRef.exportViewportAsSvg();
|
|
444
|
+
async exportViewportAsSvg(options) {
|
|
445
|
+
return this.engineRef.exportViewportAsSvg(options);
|
|
442
446
|
}
|
|
443
447
|
async exportSelectedObjectsAsPng() {
|
|
444
448
|
return this.engineRef.exportSelectedObjectsAsPng();
|
|
@@ -790,31 +794,31 @@ export class KritzelEditor {
|
|
|
790
794
|
const isLoggedIn = this.isLoggedIn;
|
|
791
795
|
const shouldShowCurrentUser = isLoggedIn;
|
|
792
796
|
const shouldShowLoginButton = this.isReady && !!this.loginConfig && !isLoggedIn;
|
|
793
|
-
return (h(Host, { key: '
|
|
797
|
+
return (h(Host, { key: 'ffacaea5d3df12a3a8b448d31db3c5949053156c', style: {
|
|
794
798
|
opacity: this.isEditorVisible ? '1' : '0',
|
|
795
799
|
visibility: this.isEditorVisible ? 'visible' : 'hidden',
|
|
796
800
|
transition: 'opacity 0.2s ease-in-out, visibility 0.2s ease-in-out',
|
|
797
|
-
} }, h("div", { key: '
|
|
801
|
+
} }, h("div", { key: '669eafee25b4f84c39469738a1337c21ab03e388', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: 'd6feb4a71c3286830fbe53a533f283c8af9a0385', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: '5bd0e6263d51119b197292b69879c1ae437f92fc', visible: this.isBackToContentButtonVisible, onBackToContent: () => this.backToContent() })), h("kritzel-engine", { key: '468f17137c51c90fd61c9179d13c449b1ac8feb9', ref: el => {
|
|
798
802
|
if (el) {
|
|
799
803
|
this.engineRef = el;
|
|
800
804
|
}
|
|
801
|
-
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, isObjectDistanceFadingActive: this.isObjectDistanceFadingActive, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.theme, themes: this.themes, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event) }), h("kritzel-controls", { key: '
|
|
805
|
+
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, isObjectDistanceFadingActive: this.isObjectDistanceFadingActive, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.theme, themes: this.themes, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event) }), h("kritzel-controls", { key: '848c30b27fb916c8480b41745bd6ec844e0b23a2', visible: this.isControlsVisible, class: { 'keyboard-open': this.isVirtualKeyboardOpen }, ref: el => {
|
|
802
806
|
if (el) {
|
|
803
807
|
this.controlsRef = el;
|
|
804
808
|
}
|
|
805
|
-
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: '
|
|
809
|
+
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.theme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: 'e998d60679c767d15617bd7ecde5ee77e781a92f', class: "top-right-buttons" }, h("kritzel-settings", { key: '43b9cdb2d10de789cc03d2a9ef5df870b8ca7bfe', ref: el => {
|
|
806
810
|
if (el) {
|
|
807
811
|
this.settingsRef = el;
|
|
808
812
|
}
|
|
809
|
-
}, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '
|
|
813
|
+
}, shortcuts: this.shortcuts, availableThemes: this.themes && this.themes.length > 0 ? this.themes.map(t => t.name) : ['light', 'dark'], settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: '74669624a1e5177125ef00e1667c880ce47cbce4', ref: el => {
|
|
810
814
|
if (el) {
|
|
811
815
|
this.exportRef = el;
|
|
812
816
|
}
|
|
813
|
-
}, workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '
|
|
817
|
+
}, workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '18d925f32d021ff6713accb22d0594d259d70f2e', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: 'bddd5c29c5f17cced47276c237c04cfdb711da38', user: this.user }), shouldShowLoginButton && (h("kritzel-button", { key: '4eb6c85459f59863d6e644ecf21c2295da71bafc', onButtonClick: () => this.loginDialogRef?.open() }, "Sign in")), h("kritzel-more-menu", { key: 'a5a323ec248bebc7bc07898f344e0926fac8db17', items: this.moreMenuItems, visible: this.isMoreMenuVisible }), h("kritzel-share-dialog", { key: '8cb3ddad95d36f5b7ad59d8c4f057df93cb2bfe3', ref: el => {
|
|
814
818
|
if (el) {
|
|
815
819
|
this.shareDialogRef = el;
|
|
816
820
|
}
|
|
817
|
-
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '
|
|
821
|
+
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '35395d0faadcfeb021fba685aa46e180e47d2be2', ref: el => {
|
|
818
822
|
if (el) {
|
|
819
823
|
this.loginDialogRef = el;
|
|
820
824
|
}
|
|
@@ -851,7 +855,7 @@ export class KritzelEditor {
|
|
|
851
855
|
"setter": false,
|
|
852
856
|
"reflect": false,
|
|
853
857
|
"attribute": "scale-max",
|
|
854
|
-
"defaultValue": "
|
|
858
|
+
"defaultValue": "1000"
|
|
855
859
|
},
|
|
856
860
|
"scaleMin": {
|
|
857
861
|
"type": "number",
|
|
@@ -871,7 +875,7 @@ export class KritzelEditor {
|
|
|
871
875
|
"setter": false,
|
|
872
876
|
"reflect": false,
|
|
873
877
|
"attribute": "scale-min",
|
|
874
|
-
"defaultValue": "
|
|
878
|
+
"defaultValue": "0.0001"
|
|
875
879
|
},
|
|
876
880
|
"lockDrawingScale": {
|
|
877
881
|
"type": "boolean",
|
|
@@ -1338,7 +1342,7 @@ export class KritzelEditor {
|
|
|
1338
1342
|
},
|
|
1339
1343
|
"getter": false,
|
|
1340
1344
|
"setter": false,
|
|
1341
|
-
"defaultValue": "
|
|
1345
|
+
"defaultValue": "{\n providers: [],\n}"
|
|
1342
1346
|
},
|
|
1343
1347
|
"assetStorageConfig": {
|
|
1344
1348
|
"type": "unknown",
|
|
@@ -1363,7 +1367,7 @@ export class KritzelEditor {
|
|
|
1363
1367
|
},
|
|
1364
1368
|
"getter": false,
|
|
1365
1369
|
"setter": false,
|
|
1366
|
-
"defaultValue": "
|
|
1370
|
+
"defaultValue": "{\n providers: [],\n}"
|
|
1367
1371
|
},
|
|
1368
1372
|
"cursorTarget": {
|
|
1369
1373
|
"type": "unknown",
|
|
@@ -1409,8 +1413,7 @@ export class KritzelEditor {
|
|
|
1409
1413
|
"text": "Optional login configuration. When provided, a \"Sign in\" button is shown that opens a login dialog with the configured providers."
|
|
1410
1414
|
},
|
|
1411
1415
|
"getter": false,
|
|
1412
|
-
"setter": false
|
|
1413
|
-
"defaultValue": "{\n providers: [\n {\n label: 'Sign in with Google',\n icon: 'google',\n name: 'Google',\n },\n ],\n }"
|
|
1416
|
+
"setter": false
|
|
1414
1417
|
},
|
|
1415
1418
|
"isLoading": {
|
|
1416
1419
|
"type": "boolean",
|
|
@@ -2094,6 +2097,33 @@ export class KritzelEditor {
|
|
|
2094
2097
|
"tags": []
|
|
2095
2098
|
}
|
|
2096
2099
|
},
|
|
2100
|
+
"panToObject": {
|
|
2101
|
+
"complexType": {
|
|
2102
|
+
"signature": "(object: KritzelBaseObject) => Promise<void>",
|
|
2103
|
+
"parameters": [{
|
|
2104
|
+
"name": "object",
|
|
2105
|
+
"type": "KritzelBaseObject<HTMLElement | SVGElement>",
|
|
2106
|
+
"docs": ""
|
|
2107
|
+
}],
|
|
2108
|
+
"references": {
|
|
2109
|
+
"Promise": {
|
|
2110
|
+
"location": "global",
|
|
2111
|
+
"id": "global::Promise"
|
|
2112
|
+
},
|
|
2113
|
+
"KritzelBaseObject": {
|
|
2114
|
+
"location": "import",
|
|
2115
|
+
"path": "../../../classes/objects/base-object.class",
|
|
2116
|
+
"id": "src/classes/objects/base-object.class.ts::KritzelBaseObject",
|
|
2117
|
+
"referenceLocation": "KritzelBaseObject"
|
|
2118
|
+
}
|
|
2119
|
+
},
|
|
2120
|
+
"return": "Promise<void>"
|
|
2121
|
+
},
|
|
2122
|
+
"docs": {
|
|
2123
|
+
"text": "",
|
|
2124
|
+
"tags": []
|
|
2125
|
+
}
|
|
2126
|
+
},
|
|
2097
2127
|
"backToContent": {
|
|
2098
2128
|
"complexType": {
|
|
2099
2129
|
"signature": "() => Promise<boolean>",
|
|
@@ -2132,6 +2162,37 @@ export class KritzelEditor {
|
|
|
2132
2162
|
"tags": []
|
|
2133
2163
|
}
|
|
2134
2164
|
},
|
|
2165
|
+
"centerObjects": {
|
|
2166
|
+
"complexType": {
|
|
2167
|
+
"signature": "(objects: KritzelBaseObject[], animate?: boolean) => Promise<boolean>",
|
|
2168
|
+
"parameters": [{
|
|
2169
|
+
"name": "objects",
|
|
2170
|
+
"type": "KritzelBaseObject<HTMLElement | SVGElement>[]",
|
|
2171
|
+
"docs": ""
|
|
2172
|
+
}, {
|
|
2173
|
+
"name": "animate",
|
|
2174
|
+
"type": "boolean",
|
|
2175
|
+
"docs": ""
|
|
2176
|
+
}],
|
|
2177
|
+
"references": {
|
|
2178
|
+
"Promise": {
|
|
2179
|
+
"location": "global",
|
|
2180
|
+
"id": "global::Promise"
|
|
2181
|
+
},
|
|
2182
|
+
"KritzelBaseObject": {
|
|
2183
|
+
"location": "import",
|
|
2184
|
+
"path": "../../../classes/objects/base-object.class",
|
|
2185
|
+
"id": "src/classes/objects/base-object.class.ts::KritzelBaseObject",
|
|
2186
|
+
"referenceLocation": "KritzelBaseObject"
|
|
2187
|
+
}
|
|
2188
|
+
},
|
|
2189
|
+
"return": "Promise<boolean>"
|
|
2190
|
+
},
|
|
2191
|
+
"docs": {
|
|
2192
|
+
"text": "",
|
|
2193
|
+
"tags": []
|
|
2194
|
+
}
|
|
2195
|
+
},
|
|
2135
2196
|
"setViewport": {
|
|
2136
2197
|
"complexType": {
|
|
2137
2198
|
"signature": "(x: number, y: number, scale: number) => Promise<void>",
|
|
@@ -2215,6 +2276,56 @@ export class KritzelEditor {
|
|
|
2215
2276
|
"tags": []
|
|
2216
2277
|
}
|
|
2217
2278
|
},
|
|
2279
|
+
"zoomIn": {
|
|
2280
|
+
"complexType": {
|
|
2281
|
+
"signature": "(factor?: number, duration?: number) => Promise<void>",
|
|
2282
|
+
"parameters": [{
|
|
2283
|
+
"name": "factor",
|
|
2284
|
+
"type": "number",
|
|
2285
|
+
"docs": ""
|
|
2286
|
+
}, {
|
|
2287
|
+
"name": "duration",
|
|
2288
|
+
"type": "number",
|
|
2289
|
+
"docs": ""
|
|
2290
|
+
}],
|
|
2291
|
+
"references": {
|
|
2292
|
+
"Promise": {
|
|
2293
|
+
"location": "global",
|
|
2294
|
+
"id": "global::Promise"
|
|
2295
|
+
}
|
|
2296
|
+
},
|
|
2297
|
+
"return": "Promise<void>"
|
|
2298
|
+
},
|
|
2299
|
+
"docs": {
|
|
2300
|
+
"text": "",
|
|
2301
|
+
"tags": []
|
|
2302
|
+
}
|
|
2303
|
+
},
|
|
2304
|
+
"zoomOut": {
|
|
2305
|
+
"complexType": {
|
|
2306
|
+
"signature": "(factor?: number, duration?: number) => Promise<void>",
|
|
2307
|
+
"parameters": [{
|
|
2308
|
+
"name": "factor",
|
|
2309
|
+
"type": "number",
|
|
2310
|
+
"docs": ""
|
|
2311
|
+
}, {
|
|
2312
|
+
"name": "duration",
|
|
2313
|
+
"type": "number",
|
|
2314
|
+
"docs": ""
|
|
2315
|
+
}],
|
|
2316
|
+
"references": {
|
|
2317
|
+
"Promise": {
|
|
2318
|
+
"location": "global",
|
|
2319
|
+
"id": "global::Promise"
|
|
2320
|
+
}
|
|
2321
|
+
},
|
|
2322
|
+
"return": "Promise<void>"
|
|
2323
|
+
},
|
|
2324
|
+
"docs": {
|
|
2325
|
+
"text": "",
|
|
2326
|
+
"tags": []
|
|
2327
|
+
}
|
|
2328
|
+
},
|
|
2218
2329
|
"getViewport": {
|
|
2219
2330
|
"complexType": {
|
|
2220
2331
|
"signature": "() => Promise<KritzelViewportState>",
|
|
@@ -2875,11 +2986,15 @@ export class KritzelEditor {
|
|
|
2875
2986
|
},
|
|
2876
2987
|
"getScreenshot": {
|
|
2877
2988
|
"complexType": {
|
|
2878
|
-
"signature": "(format?: \"png\" | \"svg\") => Promise<string | null>",
|
|
2989
|
+
"signature": "(format?: \"png\" | \"svg\", options?: { includeBackground?: boolean; }) => Promise<string | null>",
|
|
2879
2990
|
"parameters": [{
|
|
2880
2991
|
"name": "format",
|
|
2881
2992
|
"type": "\"svg\" | \"png\"",
|
|
2882
2993
|
"docs": ""
|
|
2994
|
+
}, {
|
|
2995
|
+
"name": "options",
|
|
2996
|
+
"type": "{ includeBackground?: boolean; }",
|
|
2997
|
+
"docs": ""
|
|
2883
2998
|
}],
|
|
2884
2999
|
"references": {
|
|
2885
3000
|
"Promise": {
|
|
@@ -2896,8 +3011,12 @@ export class KritzelEditor {
|
|
|
2896
3011
|
},
|
|
2897
3012
|
"exportViewportAsPng": {
|
|
2898
3013
|
"complexType": {
|
|
2899
|
-
"signature": "() => Promise<void>",
|
|
2900
|
-
"parameters": [
|
|
3014
|
+
"signature": "(options?: { includeBackground?: boolean; }) => Promise<void>",
|
|
3015
|
+
"parameters": [{
|
|
3016
|
+
"name": "options",
|
|
3017
|
+
"type": "{ includeBackground?: boolean; }",
|
|
3018
|
+
"docs": ""
|
|
3019
|
+
}],
|
|
2901
3020
|
"references": {
|
|
2902
3021
|
"Promise": {
|
|
2903
3022
|
"location": "global",
|
|
@@ -2913,8 +3032,12 @@ export class KritzelEditor {
|
|
|
2913
3032
|
},
|
|
2914
3033
|
"exportViewportAsSvg": {
|
|
2915
3034
|
"complexType": {
|
|
2916
|
-
"signature": "() => Promise<void>",
|
|
2917
|
-
"parameters": [
|
|
3035
|
+
"signature": "(options?: { includeBackground?: boolean; }) => Promise<void>",
|
|
3036
|
+
"parameters": [{
|
|
3037
|
+
"name": "options",
|
|
3038
|
+
"type": "{ includeBackground?: boolean; }",
|
|
3039
|
+
"docs": ""
|
|
3040
|
+
}],
|
|
2918
3041
|
"references": {
|
|
2919
3042
|
"Promise": {
|
|
2920
3043
|
"location": "global",
|