Skip to content

Commit

Permalink
Revert "consider safe distance for Annotations shouldRepaint function…
Browse files Browse the repository at this point in the history
…ality"

This reverts commit 55ef43d.
  • Loading branch information
ramin-deriv committed Jul 31, 2024
1 parent 55ef43d commit 5461c48
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_too
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/drawing_parts.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/drawing_pattern.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/edge_point.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/extensions/extensions.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/extensions.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/vector.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/point.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/drawing.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_too
/// | | * | -> edge point is NOT considered as off screen.
/// | | |
/// | | | * -> edge point is considered as off screen.
double edgePointOffScreenSafeDistance(int leftEpoch, int rightEpoch) =>
double _edgePointOffScreenSafeDistance(int leftEpoch, int rightEpoch) =>
(rightEpoch - leftEpoch) / 2;

/// An extension on DraggableEdgePoint class that adds some helper methods.
Expand All @@ -33,7 +33,8 @@ extension DraggableEdgePointExtension on DraggableEdgePoint {
/// returns true if the edge point is on the view port range.
bool isInViewPortRange(int leftEpoch, int rightEpoch) =>
draggedEdgePoint.epoch >=
(leftEpoch - edgePointOffScreenSafeDistance(leftEpoch, rightEpoch)) &&
(leftEpoch -
_edgePointOffScreenSafeDistance(leftEpoch, rightEpoch)) &&
draggedEdgePoint.epoch <=
(rightEpoch + edgePointOffScreenSafeDistance(leftEpoch, rightEpoch));
(rightEpoch + _edgePointOffScreenSafeDistance(leftEpoch, rightEpoch));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_too
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/drawing_parts.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/drawing_pattern.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/edge_point.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/extensions/extensions.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/extensions.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/point.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/drawing.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/drawing_data.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_too
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/drawing_parts.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/drawing_pattern.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/edge_point.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/extensions/extensions.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/extensions.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/point.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/drawing.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/drawing_data.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_too
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/drawing_parts.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/drawing_pattern.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/edge_point.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/extensions/extensions.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/extensions.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/data_model/point.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/drawing.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/drawing_tools/drawing_data.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/extensions/extensions.dart';
import 'package:flutter/material.dart';

/// Any component other than chart data (line or candle) which can take a
Expand Down Expand Up @@ -43,20 +42,11 @@ abstract class ChartObject {
_isLeftEpochOnRange(leftBoundEpoch, rightBoundEpoch) ||
_isRightEpochOnRange(leftBoundEpoch, rightBoundEpoch);

bool _isRightEpochOnRange(int leftBoundEpoch, int rightBoundEpoch) {
final double safeDistance =
edgePointOffScreenSafeDistance(leftBoundEpoch, rightBoundEpoch);
bool _isRightEpochOnRange(int leftBoundEpoch, int rightBoundEpoch) =>
rightEpoch! > leftBoundEpoch && rightEpoch! < rightBoundEpoch;

return rightEpoch! > leftBoundEpoch - safeDistance &&
rightEpoch! < rightBoundEpoch + safeDistance;
}

bool _isLeftEpochOnRange(int leftBoundEpoch, int rightBoundEpoch) {
final double safeDistance =
edgePointOffScreenSafeDistance(leftBoundEpoch, rightBoundEpoch);
return leftEpoch! > leftBoundEpoch - safeDistance &&
leftEpoch! < rightBoundEpoch + safeDistance;
}
bool _isLeftEpochOnRange(int leftBoundEpoch, int rightBoundEpoch) =>
leftEpoch! > leftBoundEpoch && leftEpoch! < rightBoundEpoch;

bool _coversEpochRange(int leftBoundEpoch, int rightBoundEpoch) =>
leftEpoch! <= leftBoundEpoch && rightEpoch! >= rightBoundEpoch;
Expand Down

0 comments on commit 5461c48

Please sign in to comment.