Code Monkey home page Code Monkey logo

Comments (7)

ehussain avatar ehussain commented on June 14, 2024 1

Thanks.

from pikaso.

raminious avatar raminious commented on June 14, 2024

Hi @ehussain

There are two ways to access Konva shapes through Pikaso.
An example will help me to explain

const circle = editor.shapes.circle.insert({ 
  /* config */
})

here circle.node has access to the Konva shape.
So in your case circle.node.zIndex(1) is the solution.

The second way is using update method that is provided by Pikaso.

circle.update({
  zIndex: 1
})

from pikaso.

ehussain avatar ehussain commented on June 14, 2024

Hello @raminious

Thanks for quick response. This is very helpful. I was able to adjust zindex of shapes using shape.update({zIndex: 1}) method as you have mentioned.

However I am still facing the issue in following scenario.

  1. let imageShape = editor.shapes.image.insert(ImageURL) - Inserts Image URL
  2. let labelShape = editor.shapes.label.insert({}) - Inserts "Untitled Text"
  3. labelShape.update({zIndex : 99}) // making sure label remains on top and it shows properly
  4. let json = editor.export.toJson();
  5. editor.reset() // reset canvas
  6. editor.import.json(json) // load previous json again

After doing above steps there is issue where image always takes top place and label gets hidden behind image.

Thanks in advance.

from pikaso.

raminious avatar raminious commented on June 14, 2024

Ok, let me try to reproduce the scenario

from pikaso.

raminious avatar raminious commented on June 14, 2024

@ehussain I could reproduce the bug https://codesandbox.io/s/floral-field-o4op8c?file=/src/index.ts

Pikaso relies on Konva's toObject method when exporting the board to JSON. in this case Konva doesn't return zIndex with created object of toObject
This is a Konva bug, and I think they should fix it, but I'll fix it myself in Pikaso since Konva does not support exporting to JSON.

from pikaso.

raminious avatar raminious commented on June 14, 2024

@ehussain
The issue has been fixed and with v2.6.0 will be released this week.
I appreciate your contribution.

from pikaso.

raminious avatar raminious commented on June 14, 2024

released https://github.com/pikasojs/pikaso/releases/tag/v2.6.0

from pikaso.

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.