internal void OnZoom(float zoomValue, PointF anchorPoint) { if (!_isControlEnter && PaddingCanvasGroupParent.IsControlDown) { _isControlEnter = true; _anchorPointWorld = GetWorldPointFromPaddingCanvasViewPoint(anchorPoint); } //anchorPoint = _anchorPointView; //anchorPointWorld.X = (int)anchorPointWorld.X; //anchorPointWorld.Y = (int)anchorPointWorld.Y; if (TestInterface != null) { TestInterface.WorldMouseX = _anchorPointWorld.X; TestInterface.WorldMouseY = _anchorPointWorld.Y; } WorldViewGroup.CanvasViewport.Scale = zoomValue; InvalidateCanvasSize(); EditorCanvasScrollHandling.InvalidateScrollMaxValue(); PointF anchorPointNew = GetPaddingCanvasViewPointFromWorldPoint(_anchorPointWorld); PointF expectedViewportInView = new PointF(anchorPointNew.X - anchorPoint.X, anchorPointNew.Y - anchorPoint.Y); PointF expectedViewportInWorld = CanvasViewport.GetViewToWorldLocation(expectedViewportInView); EditorCanvasScrollHandling.CanvasScrollbar.HValue = expectedViewportInWorld.X; EditorCanvasScrollHandling.CanvasScrollbar.VValue = expectedViewportInWorld.Y; }
public PaddingCanvasGroup(IEditorCanvasScrollbar scrollbar, int vpWidth, int vpHeight, IPaddingCanvasGroupParent @interface) : base(scrollbar, vpWidth, vpHeight) { WorldViewGroup = new CanvasViewGroup(scrollbar, vpWidth, vpHeight); PaddingTop = PaddingLeft = PaddingRight = PaddingBottom = 500; InvalidateCanvasSize(); EditorCanvasScrollHandling.InvalidateScrollMaxValue(); PaddingCanvasGroupParent = @interface; TilesModel = new TilesModel(); TilesModel.ITilesModelParent = this; WorldViewGroup.EditorCanvasRender.TilesModelParent = this; WorldViewGroup.EditorCanvasRender.RenderGrid = new RenderGrid(); WorldViewGroup.EditorCanvasRender.RenderGrid.GridInterface = this; }
public CanvasViewGroup(IEditorCanvasScrollbar scrollbar, int vpWidth, int vpHeight) { EditorCanvas = new EditorCanvas(); EditorCanvasRender = new EditorCanvasRender(); EditorCanvasScrollHandling = new EditorCanvasScrollHandling(); CanvasViewport = new CanvasViewport(0, 0, vpWidth, vpHeight, EditorCanvas); CanvasViewport.Scale = 1.0f; EditorCanvas.Width = 1000; EditorCanvas.Height = 1000; EditorCanvasRender.Canvas = EditorCanvas; EditorCanvasRender.Viewport = CanvasViewport; EditorCanvasScrollHandling.CanvasScrollbar = scrollbar; EditorCanvasScrollHandling.Canvas = EditorCanvas; EditorCanvasScrollHandling.Viewport = CanvasViewport; }