@meta2d/core 1.0.61 → 1.0.62

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/src/core.d.ts CHANGED
@@ -29,7 +29,7 @@ export declare class Meta2d {
29
29
  url?: string;
30
30
  method?: string;
31
31
  }) => boolean | string;
32
- events: Record<number, (pen: Pen, e: Event) => void>;
32
+ events: Record<number, (pen: Pen, e: Event, params?: any) => void>;
33
33
  map: ViewMap;
34
34
  mapTimer: any;
35
35
  constructor(parent: string | HTMLElement, opts?: Options);
package/src/core.js CHANGED
@@ -262,7 +262,7 @@ export class Meta2d {
262
262
  }
263
263
  console.warn('[meta2d] StopVideo event value is not a string');
264
264
  };
265
- this.events[EventAction.JS] = (pen, e) => {
265
+ this.events[EventAction.JS] = (pen, e, params) => {
266
266
  if (e.value && !e.fn) {
267
267
  try {
268
268
  if (typeof e.value !== 'string') {
@@ -275,7 +275,7 @@ export class Meta2d {
275
275
  console.error('[meta2d]: Error on make a function:', err);
276
276
  }
277
277
  }
278
- e.fn?.(pen, e.params, { meta2d: this, eventName: e.name });
278
+ e.fn?.(pen, params || e.params, { meta2d: this, eventName: e.name });
279
279
  };
280
280
  this.events[EventAction.GlobalFn] = (pen, e) => {
281
281
  if (typeof e.value !== 'string') {
@@ -2586,6 +2586,14 @@ export class Meta2d {
2586
2586
  }
2587
2587
  break;
2588
2588
  case 'click':
2589
+ if (this.store.data.locked && e.pen && (!e.pen.disabled)) {
2590
+ if (e.pen.switch) {
2591
+ e.pen.checked = !e.pen.checked;
2592
+ e.pen.calculative.checked = e.pen.checked;
2593
+ e.pen.calculative.gradient = undefined;
2594
+ e.pen.calculative.radialGradient = undefined;
2595
+ }
2596
+ }
2589
2597
  e.pen && e.pen.onClick && (!e.pen.disabled) && e.pen.onClick(e.pen, this.canvas.mousePos);
2590
2598
  this.store.data.locked && e.pen && (!e.pen.disabled) && this.doEvent(e.pen, eventName);
2591
2599
  break;