Closed Kinnear closed 4 years ago
I have only experienced this on iOS (or its far worse on iOS) if that helps
The problem there is the _isFar check has a hardcoded limit of 30
. This may also explain why it's happening rather on iOS if the device has on higher resolution.
TBH I don't understand why this check is needed in the first place, maybe someone can explain.
Indeed, the problem is the _isFar check method. The goal of this method is to avoid that, if the user gets out of the boundaries of the canvas then goes back in, the leaving and coming back points get joined by a straight line (see image below).
However, this is indeed a problem as it prevents the user to sign quickly. Maybe the limit should be an optional argument so we can customize it for our needs.
Faced the same issue. To solve this problem, i added a new variable which tells me when the input is outside my drawing field or not. So if the input coming from outside into my drawing field the next Point I add to '_points' is a PointType.tap. This prevents the paint method from drawing lines between the last point before input going outside the method and the first point coming from outside into the drawing field.
The solution looks like :
bool isOutsideDrawField = false;
void _addPoint(PointerEvent event, PointType type) {
if (_painterKey.currentContext != null) {
RenderBox box = _painterKey.currentContext.findRenderObject();
Offset o = box.globalToLocal(event.position);
//SAVE POINT ONLY IF IT IS IN THE SPECIFIED BOUNDARIES
if ((widget.width == null || o.dx > 0 && o.dx < widget.width) &&
(widget.height == null || o.dy > 0 && o.dy < widget.height)) {
setState(() {
if (isOutsideDrawField) {
type = PointType.tap;
}
_points.add(Point(o, type));
isOutsideDrawField = false;
});
} else {
if (!isOutsideDrawField) {
isOutsideDrawField = true;
}
}
}
}
There is gap yet. why?
Is this on mobile or web? Note that original issue was little different it produced gaps that was single not interconnected points. This looks more like rendering issue.
@MartinHlavna We also have a similar issue https://github.com/4Q-s-r-o/signature/issues/11#issuecomment-666246471 Tested it on Mobile.
Signing quickly on iOS or android makes the signature have gaps in-between points. Any idea what may be causing this?