Add Origin Marker#1712
Conversation
It should not need its own layer as that would be pretty heavy for just 1 shape. My first instinct was to say that it should indeed be on the grid layer, but that does also mean that it will be hidden behind fog. For DMs this is usually not a big deal as they generally will have some transparency on the fog. So it mostly depends on whether you want players to be able to see the origin. We could do it on the fow layer instead, ensuring that it's always visible, but then it will also appear on top of any shapes which also sounds weird, so the grid layer seems fine to me.
We can modify the logic to hide the full layer only when nothing has to be rendered (i.e. no grid and no origin).
You don't have to actively reset most ctx properties, it's assumed that all code configures the fill and stroke styles to something relevant for their use. The only exception I think is if you modify the
That said I'm not sure why it's relevant, in your current code you don't call any other draw functions except builtin canvas functions, so the transform you're setting is the only transform present. It's also actually not really necessary to change the transform. The regular shape draw function sets a transform because for shapes we operate under a rotation and it's just way easier to reason in this frame of reference when the (0, 0) coord is at the center of the shape. For simpler cases like here where there is no complexity of rotation, we can generally reason in the normal global transform pretty easily. (changing transform comes with a small cost, though it's rather small)
I have no strong opinion on this :p I'm personally not really sure if a circle is super clear as the origin symbol, some specific icon might be clearer. But at the same time I don't really expect to use it myself, so this might be good enough for what people want. In which case there is no need to over-engineer it. |
|
Thank you! I should have an update sometime around the middle of next week. |
|
Hmmmm.... I do think that would convey things better than a circle. I'll have to check and see if the project is already using an icon pack anywhere, and if so I'll see about lifting something from that. Right off the bat, there's this lucide dev icon, and I'm sure other icon packs have something similar. My initial estimates on when I would have time to work on this got really thrown off due to some medical things, so no eta, but I hope to have something kind of soon. |
|
PA uses the fontawesome base icon set in general. There is a specialized shape (https://github.com/Kruptein/PlanarAlly/blob/dev/client/src/game/shapes/variants/fontAwesomeIcon.ts) you can use to draw FA icons straight to the canvas. (You might have to update |
|
By default shapes size along with the zoom level. You can however pass a third parameter to the draw function to set a custom width/height which will be fixed at all zoom levels. You could try and see how that feels. |
|
Sounds good. I think I'll do location-dot unless somebody else has a good argument for a different one. And you make a good point about transparency. |







Adds an origin circle as requested in #394 .
This is an initial functional implementation to make sure I'm on the right track here.
I stole most of the implementation from
shapes/variants/circle.ts.Adjustments needed before it's ready to merge:
Questions for you about preferred implementation: