Exemplo n.º 1
0
 public DocumentRenderer(DocumentControl documentControl, Camera camera)
 {
     _documentControl    = documentControl;
     _camera             = camera;
     _backgroundRenderer = new BackgroundRenderer();
     _layerRenderer      = new LayerRenderer(documentControl);
 }
Exemplo n.º 2
0
 public Camera(Mouse mouse, DocumentControl documentControl)
 {
     _documentControl        = documentControl;
     Zoom                    = 1f;
     mouse.MiddleButtonDown += (sender, args) => StartPan(args.MouseState.Position);
     mouse.MiddleButtonUp   += (sender, args) => FinishPan();
     mouse.MouseMove        += (sender, args) =>
     {
         if (IsPanning)
         {
             UpdatePan(args.MouseState.Position);
         }
     };
     mouse.MouseWheel += (sender, args) =>
     {
         if (args.WheelValueChange > 0)
         {
             ZoomIn(GetDocumentPosition(args.MouseState.Position).ToVector2());
         }
         else
         {
             ZoomOut(GetDocumentPosition(args.MouseState.Position).ToVector2());
         }
     };
     MessageBus.Subscribe <GlyphChangedEvent>(e =>
     {
         if (e.PreviousGlyphFontViewModel != null && e.NewGlyphFontViewModel != null &&
             e.PreviousGlyphFontViewModel.GlyphSize != e.NewGlyphFontViewModel.GlyphSize)
         {
             var zoomChangeFactor = (float)e.NewGlyphFontViewModel.GlyphSize.Y / e.PreviousGlyphFontViewModel.GlyphSize.Y;
             SetPosition(Position * zoomChangeFactor);
             SetZoom(Zoom / zoomChangeFactor);
         }
     });
 }
Exemplo n.º 3
0
 public LayerRenderer(DocumentControl documentControl)
 {
     _documentControl = documentControl;
 }