Example #1
0
        private void DetachCanvas(ArtboardCanvas canvas)
        {
            Children.Remove(canvas);

            canvas.DesignWidth  = 0;
            canvas.DesignHeight = 0;
            canvas.OffsetX      = 0;
            canvas.OffsetY      = 0;
            canvas.Zoom         = 1;
        }
Example #2
0
        private void AttachCanvas(ArtboardCanvas canvas)
        {
            canvas.DesignWidth  = DesignWidth;
            canvas.DesignHeight = DesignHeight;
            canvas.OffsetX      = OffsetX;
            canvas.OffsetY      = OffsetY;
            canvas.Zoom         = Zoom;

            Children.Add(canvas);
        }
Example #3
0
            public override void SetPosition(UIElement element, Point value)
            {
                if (_snapEngineContext != null)
                {
                    value = _snapEngineContext.Engine.Snap(new ArtboardSnapParameters(new Rect(value, element.RenderSize), _snapEngineContext)).SnapRect.GetTopLeft();
                }

                ArtboardCanvas.SetPosition(element, value);

                Canvas.ArrangeChild(element);
            }
Example #4
0
 public override Point GetPosition(UIElement element)
 {
     return(ArtboardCanvas.GetPosition(element));
 }
Example #5
0
 public ArtboardCanvasDraggableAdvisor(ArtboardCanvas canvas)
 {
     Canvas = canvas;
 }
Example #6
0
 public ArtboardCanvasResizableAdvisor(ArtboardCanvas canvas)
 {
     Canvas = canvas;
 }
Example #7
0
 private static void SetCanvas(UIElement element, ArtboardCanvas canvas)
 {
     element.SetValue(CanvasProperty, canvas);
 }
Example #8
0
        private static void OnCanvasPropertyChangedPrivate(DependencyObject dependencyObject, ArtboardCanvas oldCanvas, ArtboardCanvas newCanvas)
        {
            if (ReferenceEquals(oldCanvas, newCanvas))
            {
                return;
            }

            oldCanvas?.DetachElement((UIElement)dependencyObject);
            newCanvas?.AttachElement((UIElement)dependencyObject);
        }