@pixerate/editor-svelte 0.137.1 → 0.139.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.
@@ -25,6 +25,7 @@
25
25
  startMarchingAnts,
26
26
  handleSelectionShortcut,
27
27
  handleQuickMaskKey,
28
+ handleMaskViewKey,
28
29
  ShapeDrawGesture,
29
30
  TypeToolGesture,
30
31
  DEFAULT_SHAPE_TOOL_OPTIONS,
@@ -605,7 +606,7 @@
605
606
  if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
606
607
  // Leave Copy to the page while text on it is selected.
607
608
  if (window.getSelection?.()?.toString()) return;
608
- if (handleQuickMaskKey(editor.controller, e)) {
609
+ if (handleQuickMaskKey(editor.controller, e) || handleMaskViewKey(editor.controller, e)) {
609
610
  e.preventDefault();
610
611
  return;
611
612
  }
@@ -9,6 +9,8 @@
9
9
  dropPlacement,
10
10
  dropZone,
11
11
  maskThumbnailClick,
12
+ vectorMaskThumbnail,
13
+ vectorMaskThumbnailClick,
12
14
  layerThumbnailClick,
13
15
  layerBadge,
14
16
  layerEffectsBadge,
@@ -51,6 +53,7 @@
51
53
  layers: s.layers,
52
54
  activeLayerId: s.activeLayerId,
53
55
  activeTarget: s.activeTarget,
56
+ maskView: controller.getMaskView(),
54
57
  rows: layerPanelRows(s.layers, s.activeLayerId),
55
58
  active: controller.getActiveLayer() ?? null,
56
59
  menu: layerMenu(controller),
@@ -144,6 +147,11 @@
144
147
  void tick;
145
148
  return layerHasThumbnail(layer) ? controller.getLayerThumbnail(layer.id, { maxSide: 64 }) : null;
146
149
  }
150
+ function vectorThumb(layer: ImageLayer): PixelBuffer | null {
151
+ void tick;
152
+ const { width, height } = controller.getState().imageDimensions;
153
+ return layer.vectorMask ? vectorMaskThumbnail(layer.vectorMask, width, height, 64) : null;
154
+ }
147
155
  function maskThumb(layer: ImageLayer): PixelBuffer | null {
148
156
  void tick;
149
157
  return layer.mask && !layer.mask.source ? controller.getLayerThumbnail(layer.id, { maxSide: 64, mask: true }) : null;
@@ -374,7 +382,8 @@
374
382
  use:paint={maskThumb(layer)}
375
383
  role="button"
376
384
  tabindex="0"
377
- aria-label={`${row.label} mask${layer.mask.enabled === false ? ' (disabled)' : ''}`}
385
+ aria-label={`${row.label} mask${layer.mask.enabled === false ? ' (disabled)' : ''}${snapshot.maskView?.layerId === layer.id ? ' (shown)' : ''}`}
386
+ title="Alt-click: show the mask alone · Alt+Shift-click: as an overlay"
378
387
  data-testid="layer-mask-thumbnail"
379
388
  style="width: {thumbnailSize}px; height: {thumbnailSize}px"
380
389
  class={thumbClass(row.active && snapshot.activeTarget === 'mask')}
@@ -384,6 +393,22 @@
384
393
  }}
385
394
  ></canvas>
386
395
  {/if}
396
+ {#if layer.vectorMask}
397
+ <canvas
398
+ use:paint={vectorThumb(layer)}
399
+ role="button"
400
+ tabindex="0"
401
+ aria-label={`${row.label} vector mask${layer.vectorMask.enabled === false ? ' (disabled)' : ''}`}
402
+ title="Ctrl/⌘-click: load the path as the selection · Shift-click: turn it off or on"
403
+ data-testid="layer-vector-mask-thumbnail"
404
+ style="width: {thumbnailSize}px; height: {thumbnailSize}px"
405
+ class={thumbClass(false)}
406
+ onclick={(e) => {
407
+ e.stopPropagation();
408
+ attempt(() => vectorMaskThumbnailClick(controller, layer, e));
409
+ }}
410
+ ></canvas>
411
+ {/if}
387
412
  {#if renaming === layer.id}
388
413
  <!-- svelte-ignore a11y_autofocus -->
389
414
  <input
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-svelte",
3
- "version": "0.137.1",
3
+ "version": "0.139.0",
4
4
  "description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -165,7 +165,7 @@
165
165
  "**/*.css"
166
166
  ],
167
167
  "dependencies": {
168
- "@pixerate/editor": "0.188.0"
168
+ "@pixerate/editor": "0.190.0"
169
169
  },
170
170
  "peerDependencies": {
171
171
  "@dagrejs/dagre": "^1.1.4",