feat(plot): configure one or two marker pairs per axis

This commit is contained in:
2026-09-04 12:56:16 +03:00
parent 5f8fc07f2a
commit f6787163dc
4 changed files with 31 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import math
import os
from pathlib import Path
import unittest
from dataclasses import replace
from protocan.plot import Bounds, Marker, Markers, PlotMath, Viewport
@@ -31,6 +32,9 @@ class PlotTests(unittest.TestCase):
def test_markers_stay_in_data_coordinates_and_cross(self):
bounds = Bounds(1000, 2000, -10, 10)
markers = Markers().positioned(self.core, bounds)
self.assertTrue(markers.enabled(Marker.A))
self.assertFalse(markers.enabled(Marker.C))
self.assertTrue(replace(markers, x_pairs=2).enabled(Marker.C))
zoomed = bounds.visible(self.core, Viewport(.25, .25, .5, .5))
self.assertEqual(markers, markers.positioned(self.core, zoomed))
moved = markers.drag(self.core, Marker.A, 50, 500, zoomed)