CrazyTim / spin-wheel

An easy to use, themeable component for randomising choices and prizes.
https://crazytim.github.io/spin-wheel/examples/themes
MIT License
174 stars 45 forks source link

Is there a way to draw label on top of image? #39

Open y3wk1m opened 3 months ago

y3wk1m commented 3 months ago

I tried to use item.label together with image, but it seems that the image will be on top of item.label. Is there any way to draw label on top of image? or maybe some sort like set z-index of the label to be above image?

y3wk1m commented 3 months ago

Currently I am using a workaround by creating 2 spin-wheel element on top of each other. One with background image and one with text, then make both spin together at the same time. But it would be better if can directly draw label on top of image, so dont need redundant code.

CrazyTim commented 3 months ago

Hi @y3wk1m,

I couldn't reproduce this in the latest release.

The images are drawn first, then the labels are drawn over the top of the image:

https://github.com/CrazyTim/spin-wheel/blob/7bd5423ae4bcad5747816a70b395fac1b395ad3d/src/wheel.js#L201-L203

Can you give a code sample and a screenshot? What version you are using?

y3wk1m commented 3 months ago

tqvm for your reply. I am currently using v4.3.2, you can try in examples/playground, upload an image

image

then it will cover up the items label.

image

below is the json exported from playground spin-wheel-settings(1).json