Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 23 16:43
    guru-nemo opened #833
  • Jan 22 13:41
    tomasfabry opened #832
  • Jan 22 06:32
    guru-nemo commented #831
  • Jan 21 18:52
    lavrton commented #831
  • Jan 21 18:28
    guru-nemo commented #831
  • Jan 21 13:09
    lavrton commented #831
  • Jan 21 13:04
    guru-nemo commented #831
  • Jan 21 12:20
    lavrton commented #831
  • Jan 21 12:19
    lavrton edited #831
  • Jan 21 12:18
    lavrton labeled #824
  • Jan 21 12:17
    lavrton closed #830
  • Jan 21 12:17
    lavrton commented #830
  • Jan 21 09:50
    guru-nemo edited #831
  • Jan 21 09:49
    guru-nemo edited #831
  • Jan 21 09:48
    guru-nemo opened #831
  • Jan 21 03:44
    bengao01 opened #830
  • Jan 21 02:56
    5201314999 commented #824
  • Jan 20 11:34
    ButsAndCats synchronize #825
  • Jan 19 10:21
    ItsEcholot opened #829
  • Jan 18 11:22
    kalitk0 opened #828
Anton Lavrenov
@lavrton
@Bart736 I don’t know. I tried to use that framework a very long time ago.
Not sure how it works now.
Marc Berchtold
@ItsEcholot
Hello everyone, does anyone have an idea on how to implement a drawable "closed" selection shape which selects multiple nodes on a Konva layer? I'm guessing something in the direction of boolean operations maybe? Or is there only the "brute-force" solution to check every node if it's inside the drawn shape? (Image for "better" explanation https://pasteboard.co/IQh3rDk.jpg)
Anton Lavrenov
@lavrton
There are no methods inside the Konva itself.
So you have to implement it manually.
Probably find solutions like “is polygon inside a polygon”.
Marc Berchtold
@ItsEcholot
Alright thanks for your input. How can I get a list of all points (Vector2d) inside an Konva shape/node?
Anton Lavrenov
@lavrton
There is not such function.
Only for Konva.Line
It is trivial to get points from it.
But for other shapes, you have to calculate them manually.
Marc Berchtold
@ItsEcholot
How does Konva automatically fill a shape then? It somehow has to know which pixels to fill or am I getting this wrong?
Anton Lavrenov
@lavrton
It is 2d canvas api. To fill a rect you just say ctx.fillRect(0, 0, 100, 100).
And Konva don’t need to know where is the point of top-right edge.
Marc Berchtold
@ItsEcholot
And I guess hit detection also has to know if a point is inside a shape

It is 2d canvas api. To fill a rect you just say ctx.fillRect(0, 0, 100, 100).

Ahh that makes sense

Anton Lavrenov
@lavrton

And I guess hit detection also has to know if a point is inside a shape

Yes, it Konva it works by checking pixels. So Konva simply can answer to a question “is this point inside a shape?”.

But it can’t answer “give me all edge points of a shape”.
Marc Berchtold
@ItsEcholot
Ahh ok gotcha. How expensive is this operation?
Anton Lavrenov
@lavrton
For sure you can just check EVERY pixel of the screen if it intersects the shape.
But that is slow.

How expensive is this operation?

What operation?

Marc Berchtold
@ItsEcholot
Checking if a point is inside a shape
Anton Lavrenov
@lavrton
Depends how many times you want to call it.
the fastest is layer.getIntersection(point)
Marc Berchtold
@ItsEcholot

Depends how many times you want to call it.

Would 10'000 times be a realistic number or already way too much?

Anton Lavrenov
@lavrton
Need to check. But looks too much.
Why do you want it?
Check so many times?
Marc Berchtold
@ItsEcholot
Alright thought about maybe getting all the points inside the drawn selection shape and then checking for each one if a node exists there and if so --> select it
Anton Lavrenov
@lavrton
You may try to do it in a grid. Say with 10px offset.
Much smaller checks.
Marc Berchtold
@ItsEcholot
True and should cover most cases
Anton Lavrenov
@lavrton
But making math for checking intersections is still the best solution, I think.
Marc Berchtold
@ItsEcholot
Yeah but I'm not sure if I can figure that one out so I just wanted to check for backup plan. Thanks a lot for answering all my stupid questions 👍
Marc Berchtold
@ItsEcholot
Found a small bug in the getSelfRect function in the Line class
a GitHub Issue?
Anton Lavrenov
@lavrton
@ItsEcholot yeah. It will be better to make a pull request.
Marc Berchtold
@ItsEcholot
@lavrton Done
gustavosooeiro
@gustavosooeiro
Hello fellows. I am trying to build a process model with Konva. After researching all the available Canvas libraries available, it seems that Konva might the best open source option to build canvas diagrams. Am I right?
Still I could not accomplish what I want, that is to build connectors with multiple segments, so a connector would never overflow any other objects.
HightonRidley
@HightonRidley
@lavtron Is there an issue with strokeScaleEnabled(false) on text when tweening? After I set it to false on the tween and examine the text in console, it reports as 0, instead of false. Maybe text tweening doesn't support strokeScaleEnabled?
Anton Lavrenov
@lavrton
strokeScaleEnabled is boolean. I don’t see a use case to tween boolean values.
Anesu Fitz Muzenda
@fitzmode
@lavrton Yes it did, sorted thanks
HightonRidley
@HightonRidley
@lavrton Yes. You're right about there being no use case for a boolean when tweening. Lack of clear thinking from me. Thanks :)
Jenny Rose Bie Gutierrez
@phinchik
HI guys does anyone know that is the number in height and width param in Image konva is it pixel???
adriancubillos
@adriancubillos
Anyone knows if i can have a rect with a border of different color in its sides?
Anton Lavrenov
@lavrton
@phinchik yes, it is px
@adriancubillos you can not use Konva.Rect for that. But you can draw 4 lines manually.