literallycanvas icon indicating copy to clipboard operation
literallycanvas copied to clipboard

Not possible to draw a dot on the screen

Open sahibjotsaggu opened this issue 8 years ago • 7 comments

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).

sahibjotsaggu avatar Jun 21 '16 13:06 sahibjotsaggu

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.

irskep avatar Jun 21 '16 21:06 irskep

(I could be wrong about the solution, but it's definitely related to path smoothing.)

irskep avatar Jun 21 '16 21:06 irskep

I will look into this.

sahibjotsaggu avatar Jun 22 '16 02:06 sahibjotsaggu

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.

sahibjotsaggu avatar Jun 22 '16 15:06 sahibjotsaggu

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.

irskep avatar Jun 22 '16 18:06 irskep

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

sahibjotsaggu avatar Jun 23 '16 14:06 sahibjotsaggu

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!

irskep avatar Jan 09 '18 00:01 irskep