@pixerate/editor 0.216.0 → 0.217.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.
@@ -1,5 +1,6 @@
1
1
  import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, CreateAnnotationPayload, AspectRatio, CropBox, DepthMaskOptions, ExportOptions, ImageAdjustments, ImageDimensions, ImageEditorFit, ImageEditorOptions, ImageEditorState, ImageEditorTool, ImageTransform, ImagePoint, SerializedImageEditorState, DocumentOpener } from './types.cjs';
2
2
  import { type InspectMaskEdgeOptions, type MaskEdgeReport } from './selection/inspect.cjs';
3
+ import { type CompareSelectionsOptions, type SelectionDiff } from './selection/diff.cjs';
3
4
  import { type SelectionUncertainty, type SelectionUncertaintyOptions } from './selection/uncertainty.cjs';
4
5
  import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.cjs';
5
6
  import { type MagneticEdgeOptions } from './selection/magnetic.cjs';
@@ -284,6 +285,22 @@ export interface CloneSource {
284
285
  /** A vector mask's path: several `components`, or one `shape` / `subpaths` (with `op`). */
285
286
  /** What `inspectMaskEdge` reads: the selection, a layer's painted mask or its vector mask. */
286
287
  export type MaskEdgeTarget = 'selection' | 'layer-mask' | 'vector-mask';
288
+ /** A selection `compareSelections` reads (see `selectionFrom`). */
289
+ export type SelectionSource = {
290
+ kind: 'selection';
291
+ } | {
292
+ kind: 'history';
293
+ steps?: number;
294
+ } | {
295
+ kind: 'channel';
296
+ channelId: string;
297
+ } | {
298
+ kind: 'layer-mask';
299
+ layerId: string;
300
+ } | {
301
+ kind: 'vector-mask';
302
+ layerId: string;
303
+ };
287
304
  /** A layer's edge colour as `getEdgeColor` describes it (percentages). */
288
305
  export interface EdgeColorInfo {
289
306
  layerId: string;
@@ -2066,6 +2083,22 @@ export declare class ImageEditorController {
2066
2083
  * selection has none.
2067
2084
  */
2068
2085
  selectionUncertainty(options?: SelectionUncertaintyOptions): SelectionUncertainty;
2086
+ /**
2087
+ * A selection to compare (`compareSelections`): the current one, the one `steps` undo steps
2088
+ * ago, a saved channel, or a layer's painted or vector mask. `null` is nothing selected.
2089
+ */
2090
+ selectionFrom(source: SelectionSource): SelectionMask | null;
2091
+ /**
2092
+ * What changed from selection `a` (default: before the last undo step) to `b` (default: the
2093
+ * current selection): added and removed area with their largest pieces, IoU and the coverage
2094
+ * change. With `show` (default true) the canvas tints added area green and removed red until the
2095
+ * selection next changes (view state, no undo step). Read-only otherwise.
2096
+ */
2097
+ compareSelections(a?: SelectionSource, b?: SelectionSource, options?: CompareSelectionsOptions & {
2098
+ show?: boolean;
2099
+ }): SelectionDiff;
2100
+ /** Hides the `compareSelections` overlay. */
2101
+ clearSelectionDiff(): void;
2069
2102
  /** A layer's painted mask over the canvas as a selection mask; null without one (or for a depth mask). */
2070
2103
  private layerMaskCoverage;
2071
2104
  /**
@@ -1,5 +1,6 @@
1
1
  import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, CreateAnnotationPayload, AspectRatio, CropBox, DepthMaskOptions, ExportOptions, ImageAdjustments, ImageDimensions, ImageEditorFit, ImageEditorOptions, ImageEditorState, ImageEditorTool, ImageTransform, ImagePoint, SerializedImageEditorState, DocumentOpener } from './types.js';
2
2
  import { type InspectMaskEdgeOptions, type MaskEdgeReport } from './selection/inspect.js';
3
+ import { type CompareSelectionsOptions, type SelectionDiff } from './selection/diff.js';
3
4
  import { type SelectionUncertainty, type SelectionUncertaintyOptions } from './selection/uncertainty.js';
4
5
  import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.js';
5
6
  import { type MagneticEdgeOptions } from './selection/magnetic.js';
@@ -284,6 +285,22 @@ export interface CloneSource {
284
285
  /** A vector mask's path: several `components`, or one `shape` / `subpaths` (with `op`). */
285
286
  /** What `inspectMaskEdge` reads: the selection, a layer's painted mask or its vector mask. */
286
287
  export type MaskEdgeTarget = 'selection' | 'layer-mask' | 'vector-mask';
288
+ /** A selection `compareSelections` reads (see `selectionFrom`). */
289
+ export type SelectionSource = {
290
+ kind: 'selection';
291
+ } | {
292
+ kind: 'history';
293
+ steps?: number;
294
+ } | {
295
+ kind: 'channel';
296
+ channelId: string;
297
+ } | {
298
+ kind: 'layer-mask';
299
+ layerId: string;
300
+ } | {
301
+ kind: 'vector-mask';
302
+ layerId: string;
303
+ };
287
304
  /** A layer's edge colour as `getEdgeColor` describes it (percentages). */
288
305
  export interface EdgeColorInfo {
289
306
  layerId: string;
@@ -2066,6 +2083,22 @@ export declare class ImageEditorController {
2066
2083
  * selection has none.
2067
2084
  */
2068
2085
  selectionUncertainty(options?: SelectionUncertaintyOptions): SelectionUncertainty;
2086
+ /**
2087
+ * A selection to compare (`compareSelections`): the current one, the one `steps` undo steps
2088
+ * ago, a saved channel, or a layer's painted or vector mask. `null` is nothing selected.
2089
+ */
2090
+ selectionFrom(source: SelectionSource): SelectionMask | null;
2091
+ /**
2092
+ * What changed from selection `a` (default: before the last undo step) to `b` (default: the
2093
+ * current selection): added and removed area with their largest pieces, IoU and the coverage
2094
+ * change. With `show` (default true) the canvas tints added area green and removed red until the
2095
+ * selection next changes (view state, no undo step). Read-only otherwise.
2096
+ */
2097
+ compareSelections(a?: SelectionSource, b?: SelectionSource, options?: CompareSelectionsOptions & {
2098
+ show?: boolean;
2099
+ }): SelectionDiff;
2100
+ /** Hides the `compareSelections` overlay. */
2101
+ clearSelectionDiff(): void;
2069
2102
  /** A layer's painted mask over the canvas as a selection mask; null without one (or for a depth mask). */
2070
2103
  private layerMaskCoverage;
2071
2104
  /**