Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Bringing objects to front/back #114

Open
derberni opened this issue Jul 2, 2020 · 1 comment
Open

Bringing objects to front/back #114

derberni opened this issue Jul 2, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@derberni
Copy link

derberni commented Jul 2, 2020

Hi,
another question, this time on the z-ordering of items.

My goal is to display an image, and then overlay a number of rectangles. Both the image and the rectangles can change. Probably code explains it better:

<fabric-canvas :selection="false" :width="canvasWidth" :height="canvasHeight">
      <FabricImageFromURL
        v-if="imagePresent"
        ref="bgimg"
        :id="'bg-img'"
        :url="imageUrl"
        v-on:image-loaded="handleImageLoaded"
        :selectable="false"
      ></FabricImageFromURL>
      <fabric-rectangle
        v-for="(roi, index) in rois"
        :key="index"
        :id="index"
        :height="roi.h"
        :width="roi.w"
        :left="roi.x"
        :top="roi.y"        
        :selectable="false"
      ></fabric-rectangle>
</fabric-canvas>

imageUrl and rois are both computed properties.

My problem now is, that the image is always drawn on top of everything else, independent of the order the elements are added to the fabric-canvas.
Is there currently any way in the wrapper to influence which item is placed in front of the other? My first try to use a BackgroundImage instead of ImageFromURL, however, the BackgroundImage currently does not redraw when the url property changes.

@bensladden
Copy link
Owner

Hi, For memory there is not anything in the wrapper to do this at this point however you can access the fabric object directly for now to achieve the desired outcome.

@bensladden bensladden added the enhancement New feature or request label Jul 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants