Coder Social home page Coder Social logo

Comments (10)

lavrton avatar lavrton commented on July 28, 2024 2

zIndex of Konva.Node is just current index of the node in its parent. Not like CSS property.
So you just need to place them in the correct order. Rect with zIndex = 5 first then another one.

from react-konva.

lavrton avatar lavrton commented on July 28, 2024 2

You need to have a state with an array of rectangles. Instead of setting zIndex, you just need move them in the array and then render.

from react-konva.

lavrton avatar lavrton commented on July 28, 2024 1

Ok. Looks like zIndex is confusing in react-konva. We should add a warning when someone trying to use it.
It is totally good to use zIndex in pure Konva. But it has no sense in react-konva, because for a correct order you just need to correctly define render function.

from react-konva.

bay007 avatar bay007 commented on July 28, 2024

Hi @lavrton ; you talk about this?
<Rect zIndex = {5} name="top-right" x={width - size / 2} y={-size / 2} {...attributes} />

from react-konva.

bay007 avatar bay007 commented on July 28, 2024

I want to perform like that this
https://konvajs.github.io/docs/groups_and_layers/Layering.html in react, I think cant be make only defining render function.

from react-konva.

lavrton avatar lavrton commented on July 28, 2024

Using zIndex manually with react-konva is antipattern because react-konva will reset the order of nodes on a component update.

from react-konva.

bay007 avatar bay007 commented on July 28, 2024

@lavrton Thanks a lot, I going to try with your comment, I will write my comments about this.

from react-konva.

bay007 avatar bay007 commented on July 28, 2024

Amazing.... that works for me...

from react-konva.

lavrton avatar lavrton commented on July 28, 2024

https://konvajs.org/docs/react/zIndex.html

from react-konva.

noumankhan95 avatar noumankhan95 commented on July 28, 2024

yes but what if i have many icons and shapes on my canvas , and im trying to move an icon over a circle shape ?

from react-konva.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.