mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Fix ControlsExample
This commit is contained in:
parent
f8cfcfbc64
commit
57deab6617
3 changed files with 7 additions and 5 deletions
|
@ -681,6 +681,8 @@ class InteractiveDevelopment(Scene):
|
|||
|
||||
|
||||
class ControlsExample(Scene):
|
||||
drag_to_pan = False
|
||||
|
||||
def setup(self):
|
||||
self.textbox = Textbox()
|
||||
self.checkbox = Checkbox()
|
||||
|
|
|
@ -1319,11 +1319,9 @@ class Mobject(object):
|
|||
for mob in self.get_family(recurse):
|
||||
data = mob.data if mob.has_points() > 0 else mob._data_defaults
|
||||
if color is not None:
|
||||
if isinstance(color, list):
|
||||
rgbs = np.array(list(map(color_to_rgb, color)))
|
||||
rgbs = np.array(list(map(color_to_rgb, listify(color))))
|
||||
if 1 < len(rgbs) < len(data):
|
||||
rgbs = resize_with_interpolation(rgbs, len(data))
|
||||
else:
|
||||
rgbs = color_to_rgb(color)
|
||||
data[name][:, :3] = rgbs
|
||||
if opacity is not None:
|
||||
if isinstance(opacity, list):
|
||||
|
|
|
@ -60,6 +60,7 @@ class Scene(object):
|
|||
random_seed: int = 0
|
||||
pan_sensitivity: float = 0.5
|
||||
scroll_sensitivity: float = 20
|
||||
drag_to_pan: bool = True
|
||||
max_num_saved_states: int = 50
|
||||
default_camera_config: dict = dict()
|
||||
default_window_config: dict = dict()
|
||||
|
@ -831,7 +832,8 @@ class Scene(object):
|
|||
modifiers: int
|
||||
) -> None:
|
||||
self.mouse_drag_point.move_to(point)
|
||||
self.frame.shift(-d_point)
|
||||
if self.drag_to_pan:
|
||||
self.frame.shift(-d_point)
|
||||
|
||||
event_data = {"point": point, "d_point": d_point, "buttons": buttons, "modifiers": modifiers}
|
||||
propagate_event = EVENT_DISPATCHER.dispatch(EventType.MouseDragEvent, **event_data)
|
||||
|
|
Loading…
Add table
Reference in a new issue