Closed Dr-Usman closed 1 year ago
Hi, what is the use case for this? For me it seems more like "general drawing" rather than signature feature. If I understand correctly, you want to change pen color "mid-drawing" and have lines of different colors.
That would be be problematic, since we are saving now just the points with their type. If we would just change pen color, then all existing points could change color (for example when you export and import points for some reason).
Or you want change the color and have everything adapted to a new one (maybe when changing theme) ? We would need to recreate canvas and redraw anything in that case.
Thank you for replying. If it is possible to update color property and then create new color lines that would be good also but if it's possible to change the pen color and already lines can also adapted to that. Mean points will be remain same. I worked around like that which is re initialize the controller with existing points but different color.
Here are some use cases I can come up with for supporting this:
If this is to be implemented, I feel like the SignatureController
should switch from having a List<Point>
as its main datastructure, to working with a List<Stroke>
, where each Stroke
internally would be a List<Point>
. That way we can add metadata (like color) to every stroke, rather than every single point.
Features like redo/undo and svg export currently uses _latestActions
as a replacement for strokes. This requires every Point
to have a PointType
, which in a sense just indicates which stroke it is part of. This could be removed, as it would be inherently stored.
The other methods that use a List<Point>
can just flatten the list of strokes by doing this:
List<Point> get points => strokes.expand((s) => s.points).toList();
I think this would decrease both computation required and storage used.
The idea behind created a request is can draw signature and while on same canvas can update color of stroke and then write again different color. If it's possible i think it's be much helpful. But if can't then is there any possibility to just update all colors of drawing while having same points instead of re initialize the controller with same points and different color.
this idea is going beyond the scope of this plugin. it would start to move towards something like a simple drawing canvas. we would like to keep the KISS principle in place here and do only one thing and do it well.
In Signature Controller, Pen color is final. It should be able to update just color.