literallycanvas
literallycanvas copied to clipboard
Not possible to draw a dot on the screen
Currently, I have tried on touch devices and on the computer but it seems like it's not possible to draw dots on the screen without having to drag the cursor a bit.
This is useful to me as I am using LC without GUI for a signature feature where people might need to add dots for their signatures (with letters i and j).
This happens because the line smoothing logic doesn't have enough data to produce a smoothed line.
I suggest you add logic to the pencil tool to create a non-smoothed line path shape if there are less than 4 points.
(I could be wrong about the solution, but it's definitely related to path smoothing.)
I will look into this.
From line 323 in shapes.coffee
:
if not @smoothedPoints or @points.length < @sampleSize
@smoothedPoints = bspline(@points, @order)
When clicking only once, bspline()
returns 15 items in @smoothedPoints
all with the same x and y coordinates, but different id's. I think this is where the problem lies. Not sure where to go from here though.
Here is where I suspect the real problem is: the line rendering code. You might need to add a special case that draws a dot if two points are the same.
You might also modify the conditional you pasted to set @smoothedPoints
to @points
if @points.length == 1
, to avoid a huge number of duplicate points.
So currently, I have it working but it is kind of glitchy. All my changes are in canvasRenderer.coffee and when I put that check for @points.length == 1
in shapes.coffee, nothing seems to work.
This is my commit
I just tried this again, and it's still happening, specifically on touch devices. Of all the many issues in the tracker right now, this is the one I am most likely to actually fix!