dymokomi/luced-3d
Source of release 0.11.6
0.11.6 / src / sketch_camera.luc
## The pane's view while a sketch is edited: entering one (a Sketch node, an
## Edit CAD sketch, a sketch on a face) turns the active pane to look square
## at its plane, orthographic (sketch_frames.look_at); its view before is
## kept here, and given back once no sketch is edited (Finish Sketch, another
## node selected, an undo). The camera menu may still switch the pane to
## Perspective meanwhile; leaving sets the kept view back all the same. In
## four panes only that pane turns.
from workspace import Workspace
## Keep the active pane's view to give back, unless one is kept already (a
## new plane picked while sketching keeps the first).
pub func keep(w: Workspace):
if w.sketch_view.length > 0:
return
w.sketch_pane = w.panes.active
w.sketch_view = w.panes.view().state()
## Give the kept view back once no sketch is edited; whether it did.
pub func follow(w: Workspace) -> bool!:
if w.sketch_view.length == 0 or w.sketching():
return false
w.panes.views[w.sketch_pane].set_state(w.sketch_view)
w.sketch_view = []
w.revision += 1
return true