Skip to content

Commit

Permalink
Fix: repaint polygons/polylines on changes. (#1825)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays authored Feb 13, 2024
1 parent f9d37df commit f31829f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 7 additions & 4 deletions lib/src/layer/polygon_layer/painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,12 @@ class _PolygonPainter extends CustomPainter {
path.addPolygon(offsets, true);
}

// TODO: Fix bug where wrapping layer in some widgets (eg. opacity) causes the
// features to not move unless this is `true`, but `true` significantly impacts
// performance
@override
bool shouldRepaint(_PolygonPainter oldDelegate) => false;
bool shouldRepaint(_PolygonPainter oldDelegate) =>
polygons != oldDelegate.polygons ||
triangles != oldDelegate.triangles ||
camera != oldDelegate.camera ||
bounds != oldDelegate.bounds ||
drawLabelsLast != oldDelegate.drawLabelsLast ||
polygonLabels != oldDelegate.polygonLabels;
}
9 changes: 5 additions & 4 deletions lib/src/layer/polyline_layer/painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,12 @@ class _PolylinePainter<R extends Object> extends CustomPainter {
LatLng _unproject(DoublePoint p0) =>
camera.crs.projection.unprojectXY(p0.x, p0.y);

// TODO: Fix bug where wrapping layer in some widgets (eg. opacity) causes the
// features to not move unless this is `true`, but `true` significantly impacts
// performance
@override
bool shouldRepaint(_PolylinePainter<R> oldDelegate) => false;
bool shouldRepaint(_PolylinePainter<R> oldDelegate) =>
polylines != oldDelegate.polylines ||
camera != oldDelegate.camera ||
hitNotifier != oldDelegate.hitNotifier ||
minimumHitbox != oldDelegate.minimumHitbox;
}

const _distance = Distance();

0 comments on commit f31829f

Please sign in to comment.