DrSensor / vue-annotator

Vue Component for drawing annotation (rect, polygon, etc) using SVG element
http://vue-annotator.surge.sh
MIT License
79 stars 16 forks source link

run event select after event @draw-end="createRect" #25

Open patrykKlimczak opened 4 years ago

patrykKlimczak commented 4 years ago

Hi, I have problem with run methods after methods

createRect() {
      const canvas = this.$refs.canvas;
      const eIsSameNode = e.node.isSameNode(canvas);
      this.$refs.canvas._events.select(eIsSameNode);
}

Now: image

I need to create new rect element and just now select this:

image

DrSensor commented 4 years ago

Could you tell me:

patrykKlimczak commented 4 years ago
  1. Google Chrome Version: 79.0.3945.130
  2. Vue: 2.5.18
  3. image

I try this:

<v-annotator ref="canvas"
                  class="border"
                  inertia
                  :delete.sync="deletingRect.status"
                  :drawing="true"
                  :minSize="[20, 20]"
                  @select="getSelect"
                  @draw-end="createRect"
                  @resize-end="changeRect"
                  @move-end="changeRect"
                  :grid="[5, 5]">
                  <img draggable="false" :src="screenImg" />
                  <rect slot="drawing" class="rectDrawing" stroke="red"/>
              </v-annotator>

And I need to @draw-end event run select event on refs component @select

patrykKlimczak commented 4 years ago

I has this methods:

this.$refs.canvas.$listeners.select();

but I have error

image

Scope function on refs:

image