Skip to content

Commit

Permalink
Optimize field widget when not showing trajectories
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Oct 10, 2023
1 parent f0e40d7 commit 6afee51
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/widgets/nt4_widgets/multi-topic/field_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -380,19 +380,23 @@ class FieldWidget extends StatelessWidget with NT4Widget {
continue;
}

if (objectPositionRaw.length > 24 && !showTrajectories) {
continue;
} else if (!showOtherObjects) {
continue;
}

List<double> objectPosition =
objectPositionRaw.whereType<double>().toList();

for (int i = 0; i < objectPosition.length - 2; i += 3) {
if (objectPosition.length > 12) {
if (showTrajectories) {
trajectoryPoints.add(getTrajectoryPoint(
objectPosition.sublist(i, i + 3),
center,
fieldCenter,
scaleReduction));
}
} else if (showOtherObjects) {
if (objectPosition.length > 24) {
trajectoryPoints.add(getTrajectoryPoint(
objectPosition.sublist(i, i + 3),
center,
fieldCenter,
scaleReduction));
} else {
otherObjects.add(getTransformedFieldObject(
objectPosition.sublist(i, i + 3),
center,
Expand Down

0 comments on commit 6afee51

Please sign in to comment.