public CreatureStructureEditorCanvasVM(CreatureVM creature, ToolCollectionVM toolCollectionVM) { HistoryStack = new HistoryStackVM <CreatureStructureEditorCanvasVM>(this); HistoryStack.PropertyChanged += (o, e) => Reset(); Creature = creature; CameraVM = new CameraVM { OffsetX = -CanvasWidth / 2, OffsetY = -CanvasHeight / 2 }; ToolCollectionVM = toolCollectionVM; CanvasSizeChangedCommand = new DelegateHandleCommand <SizeChange>(CanvasSizeChanged, o => true); CanvasMouseDownCommand = new DelegateHandleCommand <MouseInfo>(mouseInfo => ToolCollectionVM.SelectedTool?.OnCanvasMouseDown(mouseInfo, this, Keyboard.Modifiers) == true, o => true); CanvasMouseUpCommand = new DelegateHandleCommand <MouseInfo>(mouseInfo => ToolCollectionVM.SelectedTool?.OnCanvasMouseUp(mouseInfo, this, Keyboard.Modifiers) == true, o => true); CanvasMouseMoveCommand = new DelegateHandleCommand <MouseInfo>(mouseInfo => ToolCollectionVM.SelectedTool?.OnCanvasMouseMove(mouseInfo, this, Keyboard.Modifiers) == true, o => true); CanvasMouseWheelCommand = new DelegateHandleCommand <MouseWheelInfo>(mouseWheelInfo => ToolCollectionVM .SelectedTool?.OnCanvasMouseWheel(mouseWheelInfo, this, Keyboard .Modifiers) == true, o => true); CanvasMouseEnterCommand = new DelegateCommand(o => ToolCollectionVM.SelectedTool?.OnCanvasMouseEnter(this, Keyboard.Modifiers), o => true); CanvasMouseLeaveCommand = new DelegateCommand(o => ToolCollectionVM.SelectedTool?.OnCanvasMouseLeave(this, Keyboard.Modifiers), o => true); }
private bool CanvasSizeChanged(SizeChange sizeChange) { CameraVM.UpdateBoundaries(); return(true); }