Browse Source

Add refresh to CanvasSpots

canvas-spot
Artur Arseniev 3 years ago
parent
commit
7972b578b4
  1. 3
      src/canvas/index.ts
  2. 11
      src/canvas/model/CanvasSpots.ts
  3. 2
      src/commands/view/SelectComponent.ts

3
src/canvas/index.ts

@ -772,7 +772,6 @@ export default class CanvasModule extends Module<CanvasConfig> {
} }
refreshSpots() { refreshSpots() {
const { em, events } = this; this.spots.refresh();
em.trigger(events.spot);
} }
} }

11
src/canvas/model/CanvasSpots.ts

@ -11,11 +11,20 @@ export default class CanvasSpots extends ModuleCollection<CanvasSpot> {
this.on('remove', this.onRemove); this.on('remove', this.onRemove);
} }
refresh() {
const { em, events } = this;
em.trigger(events.spot);
}
__trgEvent(event: string, props: ObjectAny) { __trgEvent(event: string, props: ObjectAny) {
const { module } = this; const { module } = this;
const { em } = module; const { em } = module;
em.trigger(event, props); em.trigger(event, props);
module.refreshSpots(); this.refresh();
}
get em() {
return this.module.em;
} }
get events() { get events() {

2
src/commands/view/SelectComponent.ts

@ -29,7 +29,7 @@ let showOffsets: boolean;
* *
*/ */
export default { export default {
init(o: any) { init() {
bindAll(this, 'onHover', 'onOut', 'onClick', 'onFrameScroll', 'onFrameUpdated', 'onContainerChange'); bindAll(this, 'onHover', 'onOut', 'onClick', 'onFrameScroll', 'onFrameUpdated', 'onContainerChange');
}, },

Loading…
Cancel
Save