canvas-editor-engine 1.1.14 → 1.1.16

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,8 +1,9 @@
1
- import type { IDrawImageArgs, IFilterOptions, IImageOptions } from "../types/image";
1
+ import type { IDrawImageArgs, IFilterOptions, IImageLoggingDataVague, IImageOptions } from "../types/image";
2
2
  export default class DrawService {
3
3
  static scImage: SCImage;
4
4
  static drawImage(ctx: CanvasRenderingContext2D, src: string, options: IDrawImageArgs): void;
5
5
  static drawSmoothImage(useStore: boolean, options: IDrawImageArgs, filterOptions: IFilterOptions): void;
6
+ private static updateImageStateAfterVague;
6
7
  private static getFilterArgs;
7
8
  }
8
9
  export declare class SCImage {
@@ -11,5 +12,5 @@ export declare class SCImage {
11
12
  constructor(src: string, ctx: CanvasRenderingContext2D);
12
13
  get(): HTMLImageElement;
13
14
  draw(options: IDrawImageArgs): Promise<unknown>;
14
- vague(options: IImageOptions, filterOptions: IFilterOptions): Promise<import("../types/image").IImageLoggingDataVague>;
15
+ vague(options: IImageOptions, filterOptions: IFilterOptions): Promise<IImageLoggingDataVague>;
15
16
  }
@@ -28,19 +28,16 @@ class DrawService {
28
28
  const filterArgs = DrawService.getFilterArgs(useStore, options);
29
29
  event_service_1.default.dispatch('loading-start');
30
30
  this.scImage.vague(filterArgs, filterOptions)
31
- .then(({ imageData, position, size, quality }) => {
32
- store_1.default.store.imageState.reduce({
33
- tempImageData: imageData,
34
- position: position,
35
- size: {
36
- width: size.width,
37
- height: size.height,
38
- }
39
- }, `[Filter Vague] quality: ${quality}`);
40
- })
41
- .finally(() => {
42
- event_service_1.default.dispatch('loading-end');
43
- });
31
+ .then(DrawService.updateImageStateAfterVague)
32
+ .finally(() => event_service_1.default.dispatch('loading-end'));
33
+ }
34
+ static updateImageStateAfterVague(data) {
35
+ const { imageData, position, size, quality } = data;
36
+ store_1.default.store.imageState.reduce({
37
+ tempImageData: imageData,
38
+ position: position,
39
+ size: size,
40
+ }, `[Filter Vague] quality: ${quality}`);
44
41
  }
45
42
  static getFilterArgs(useStore, options) {
46
43
  let filterArgs;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HistoryState = void 0;
4
+ const through_history_service_1 = require("../services/through-history.service");
4
5
  ;
5
6
  class HistoryState {
6
7
  default = {
@@ -18,9 +19,11 @@ class HistoryState {
18
19
  switch (name) {
19
20
  case 'SET_HISTORY':
20
21
  reducer.setHistoryLines(payload);
22
+ through_history_service_1.default.clearCache();
21
23
  break;
22
24
  case 'UPDATE_HISTORY':
23
25
  reducer.updateHistoryLines(payload);
26
+ through_history_service_1.default.clearCache();
24
27
  break;
25
28
  case 'REDO':
26
29
  reducer.updateHistoryLines(payload);
@@ -9,5 +9,5 @@ export declare class Store implements StoreService {
9
9
  }
10
10
  export default class AppStore {
11
11
  static store: Store;
12
- static subscribe(to: 'image' | 'history', completeIt: (...args: any) => void): void;
12
+ static subscribe(to: 'history', completeIt: (...args: any) => void): void;
13
13
  }
@@ -1,15 +1,6 @@
1
- import { IPosition, ISize } from "./general";
2
1
  export interface IHistoryLine {
3
2
  stateName: string;
4
3
  stateValue: any;
5
4
  view: string;
6
5
  }
7
6
  export type TReducerNames = 'SET_HISTORY' | 'UPDATE_HISTORY' | 'UNDO' | 'REDO';
8
- export interface IImageLoggingData {
9
- imageData: ImageData;
10
- size: ISize;
11
- position: IPosition;
12
- }
13
- export interface IImageLoggingDataVague extends IImageLoggingData {
14
- quality: number;
15
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",