@@ -75,8 +75,6 @@ def __init__(
7575 self ,
7676 selection : float ,
7777 limits : Sequence [float ],
78- size : float ,
79- center : float ,
8078 axis : str = "x" ,
8179 parent : Graphic = None ,
8280 edge_color : str | Sequence [float ] | np .ndarray = "w" ,
@@ -95,12 +93,6 @@ def __init__(
9593 limits: (int, int)
9694 (min, max) limits along the x or y-axis for the selector, in data space
9795
98- size: float
99- size of the selector, usually the range of the data
100-
101- center: float
102- center offset of the selector on the orthogonal axis, usually the data mean
103-
10496 axis: str, default "x"
10597 "x" | "y", the axis along which the selector can move
10698
@@ -131,29 +123,22 @@ def __init__(
131123
132124 self ._limits = np .asarray (limits )
133125
134- end_points = [- size / 2 , size / 2 ]
135-
136126 if axis == "x" :
137- xs = np .array ([selection , selection ])
138- ys = np .array (end_points )
139- zs = np .zeros (2 )
127+ xs = np .array ([selection , selection ], dtype = np . float32 )
128+ ys = np .array ([ 0 , 1 ], dtype = np . float32 )
129+ zs = np .zeros (2 , dtype = np . float32 )
140130
141- line_data = np .column_stack ([xs , ys , zs ])
142131 elif axis == "y" :
143- xs = np .array (end_points )
144- ys = np .array ([selection , selection ])
145- zs = np .zeros (2 )
132+ xs = np .array ([ 0 , 1 ], dtype = np . float32 )
133+ ys = np .array ([selection , selection ], dtype = np . float32 )
134+ zs = np .zeros (2 , dtype = np . float32 )
146135
147- line_data = np .column_stack ([xs , ys , zs ])
148136 else :
149- raise ValueError ("`axis` must be one of 'x' or 'y'" )
137+ raise ValueError ("`axis` must be one of 'x' | 'y'" )
150138
151- line_data = line_data . astype ( np .float32 )
139+ line_data = np .column_stack ([ xs , ys , zs ] )
152140
153- if thickness < 1.1 :
154- material = pygfx .LineThinMaterial
155- else :
156- material = pygfx .LineMaterial
141+ material = pygfx .LineInfiniteSegmentMaterial
157142
158143 self .colors_outer = pygfx .Color ([0.3 , 0.3 , 0.3 , 1.0 ])
159144
@@ -178,9 +163,9 @@ def __init__(
178163 world_object .add (line_inner )
179164
180165 if axis == "x" :
181- offset = (parent .offset [0 ], center + parent . offset [ 1 ] , 0 )
166+ offset = (parent .offset [0 ], 0 , 0 )
182167 elif axis == "y" :
183- offset = (center + parent . offset [ 0 ] , parent .offset [1 ], 0 )
168+ offset = (0 , parent .offset [1 ], 0 )
184169
185170 # init base selector
186171 BaseSelector .__init__ (
0 commit comments