question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I drawing by order

See original GitHub issue

I want to create a drawing project But It order by vue code

<v-stage
      ref="stage"
      :config="stageSize"
      @mousemove="move"
      @touchmove="handleMouseMove"
      @mouseDown="handleMouseDown"
      @touchstart="handleMouseDown"
      @mouseUp="handleMouseUp"
      @touchend="handleMouseUp"
    >
      <v-layer ref="layer">
        <v-image
          :config="{ image: image, draggable: true, centeredScaling: true }"
        />
        <v-image :config="{ image: image2, draggable: true }" />
        <v-rect
          v-for="(rec, recIndex) in recs"
          :key="`recIndex_${recIndex}`"
          :config="{
            x: Math.min(rec.startPointX, rec.startPointX + rec.width),
            y: Math.min(rec.startPointY, rec.startPointY + rec.height),
            width: Math.abs(rec.width),
            height: Math.abs(rec.height),
            fill: 'rgb(0,0,0,0)',
            stroke: 'black',
            strokeWidth: 3,
          }"
        />
        <v-text
          ref="text"
          :config="{
            x: 10,
            y: 10,
            fontSize: 20,
            text: text,
            fill: 'black',
          }"
        />
        <v-line
          v-for="(line, lineIndex) in lines"
          :key="`lineIndex_${lineIndex}`"
          :config="{
            stroke: line.color,
            strokeWidth: line.width,
            globalCompositeOperation: line.globalCompositeOperation,
            lineCap: 'round',
            points: line.points,
          }"
        ></v-line>
      </v-layer>
    </v-stage>

My step is

  1. draw red line
  2. draw square
  3. draw pink line image

I want canvas render by drawing order, Is square up than red line I didn’t use z-index because that all change z-index but I just want after brush move up

can anyone help me ? thank

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
lavrtoncommented, Mar 30, 2022

In your data you should NOT have separate variables recs and lines and probably others. You just need to have one array. Like items or elements or anything you want. Then every item in that array should have type property. Type can be rectangle, line or any other type of drawing you want to have. Then on your template you will need to have just one loop over this one array

<element-component
          v-for="element in elements"
          :key="element.id"
          :element="element"
/>

Then you will have to define element-component. Where it will draw itself based on type attribute. Type is rectangle then you use v-rect for it. Type is line you use v-line for it and so on.

0reactions
mei860821commented, Apr 12, 2022

I coding whole and it can be work , didn’t have error. thanks very much!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Order Drawing - Etsy
Check out our custom order drawing selection for the very best in unique or custom, handmade pieces from our prints shops.
Read more >
How to get an order of portrait sketches - Quora
Start with a light sketch. · Start with a light outline. · Add shadows and smudge them. · To make your sketch look...
Read more >
Draw Order in AutoCAD – DDSCAD | Digital Drafting Systems
The “Draw Order” tools in AutoCAD allow us to display objects behind or in front of other objects properly.
Read more >
Order of Draw for Phlebotomy & Study Guide
When we speak of “order of draw” what exactly are we talking about? In phlebotomy, this term has special meaning as it is...
Read more >
Order of Draw - Express Lab
Order of Draw ... To avoid cross-contamination, blood must be drawn and collected in tubes in a specific order. This is known as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found