Skip to content

Commit

Permalink
App improvements
Browse files Browse the repository at this point in the history
- Refresh canvas after clearing lines
- Attempt do disable vsync (usually gets overriden by GPU setting)
- Make axes smaller
  • Loading branch information
Jcparkyn committed Nov 8, 2023
1 parent 41b3a34 commit 329a6b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class StylusUpdateData(NamedTuple):

class CanvasWrapper:
def __init__(self):
self.canvas = SceneCanvas(size=CANVAS_SIZE)
self.canvas = SceneCanvas(size=CANVAS_SIZE, vsync=False)
self.canvas.measure_fps()
self.canvas.connect(self.on_key_press)
self.grid = self.canvas.central_widget.add_grid()
Expand Down Expand Up @@ -119,6 +119,8 @@ def __init__(self):
)

axis = scene.visuals.XYZAxis(parent=self.view_top.scene)
axis.transform = transforms.MatrixTransform()
axis.transform.scale([0.02, 0.02, 0.02])
# This is broken for now, see https://github.com/vispy/vispy/issues/2363
# grid = scene.visuals.GridLines(parent=self.view_top.scene)

Expand Down Expand Up @@ -157,6 +159,7 @@ def refresh_line(self):

def clear_line(self):
self.line_data_col[:, 3] *= 0
self.refresh_line()

def set_line_color(self, col: QtGui.QColor):
self.line_color = col.getRgbF() # (col.redF, col.greenF, col.blueF)
Expand All @@ -173,6 +176,7 @@ def clear_last_stroke(self):
last_stroke_index = start_indices[-1]
print(TRAIL_POINTS - last_stroke_index)
self.line_data_col[last_stroke_index:, 3] *= 0
self.refresh_line()

def on_key_press(self, e: vispy.app.canvas.KeyEvent):
# if e.key == "R":
Expand Down

0 comments on commit 329a6b1

Please sign in to comment.