public void Save(IGraphSceneDisplay <IVisual, IVisualEdge> display) { Scene = display.Data; Layout = display.Layout; Info = SceneInfo.FromInfo(display.Info); Offset = display.Viewport.ClipOrigin; Zoom = display.Viewport.ZoomFactor; ZoomState = display.Viewport.ZoomState; }
public void Restore(IGraphSceneDisplay <IVisual, IVisualEdge> display) { display.Data = Scene; display.Info = SceneInfo.FromInfo(Info); var layout = Layout; if (layout == null) { var styleSheet = Registry.Pooled <StyleSheets>()[StyleSheetName]; Func <IGraphScene <IVisual, IVisualEdge> > scene = () => display.Data; layout = Registry.Create <IGraphSceneLayout <IVisual, IVisualEdge> >(scene, styleSheet); } display.Layout = layout; display.Viewport.ClipOrigin = Offset; display.Viewport.ZoomState = ZoomState; if (ZoomState == ZoomState.Custom) { display.Viewport.ZoomFactor = Zoom; } }