Interaction logic for ContainerViewControl xaml.
Inheritance: Avalonia.Controls.UserControl
Ejemplo n.º 1
0
        /// <summary>
        /// Attach project editor to container control.
        /// </summary>
        public void AttachEditor()
        {
            _projectEditor = this.DataContext as ProjectEditor;
            _containerControl = this.Find<ContainerViewControl>("containerControl");
            _zoomBorder = this.Find<ZoomBorder>("zoomBorder");

            if (_projectEditor != null && _containerControl != null && _zoomBorder != null)
            {
                _projectEditor.Invalidate = () => _containerControl.InvalidateVisual();
                _projectEditor.ResetZoom = () => _zoomBorder.Reset();
                _projectEditor.AutoFitZoom = () => _zoomBorder.AutoFit();
                _projectEditor.LoadLayout = () => { };
                _projectEditor.SaveLayout = () => { };
                _projectEditor.ResetLayout = () => { };

                _zoomBorder.InvalidatedChild = InvalidateChild;

                _inputProcessor = new InputProcessor(
                    new AvaloniaInputSource(
                        _zoomBorder,
                        _containerControl,
                        _zoomBorder.FixInvalidPointPosition), 
                    _projectEditor);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Attach project editor to container control.
        /// </summary>
        public void AttachEditor()
        {
            _projectEditor    = this.DataContext as ProjectEditor;
            _containerControl = this.Find <ContainerViewControl>("containerControl");
            _zoomBorder       = this.Find <ZoomBorder>("zoomBorder");

            if (_projectEditor != null && _containerControl != null && _zoomBorder != null)
            {
                _projectEditor.Invalidate  = () => _containerControl.InvalidateVisual();
                _projectEditor.ResetZoom   = () => _zoomBorder.Reset();
                _projectEditor.AutoFitZoom = () => _zoomBorder.AutoFit();
                _projectEditor.LoadLayout  = () => { };
                _projectEditor.SaveLayout  = () => { };
                _projectEditor.ResetLayout = () => { };

                _zoomBorder.InvalidatedChild = InvalidateChild;

                _inputProcessor = new InputProcessor(
                    new AvaloniaInputSource(
                        _zoomBorder,
                        _containerControl,
                        _zoomBorder.FixInvalidPointPosition),
                    _projectEditor);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Detach project editor from container control.
        /// </summary>
        public void DetachEditor()
        {
            if (_projectEditor != null && _containerControl != null && _zoomBorder != null)
            {
                _projectEditor.Invalidate  = null;
                _projectEditor.ResetZoom   = null;
                _projectEditor.AutoFitZoom = null;
                _projectEditor.LoadLayout  = null;
                _projectEditor.SaveLayout  = null;
                _projectEditor.ResetLayout = null;

                _zoomBorder.InvalidatedChild = null;

                _inputProcessor.Dispose();
            }

            _projectEditor    = null;
            _containerControl = null;
            _zoomBorder       = null;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Detach project editor from container control.
        /// </summary>
        public void DetachEditor()
        {
            if (_projectEditor != null && _containerControl != null && _zoomBorder != null)
            {
                _projectEditor.Invalidate  = null;
                _projectEditor.ResetZoom   = null;
                _projectEditor.AutoFitZoom = null;
                _projectEditor.LoadLayout  = null;
                _projectEditor.SaveLayout  = null;
                _projectEditor.ResetLayout = null;

                _zoomBorder.InvalidatedChild = null;
                _zoomBorder.PointerPressed  -= ZoomBorder_PointerPressed;
                _zoomBorder.PointerReleased -= ZoomBorder_PointerReleased;
                _zoomBorder.PointerMoved    -= ZoomBorder_PointerMoved;
            }

            _projectEditor    = null;
            _containerControl = null;
            _zoomBorder       = null;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Attach project editor to container control.
        /// </summary>
        public void AttachEditor()
        {
            _projectEditor    = this.DataContext as ProjectEditor;
            _containerControl = this.Find <ContainerViewControl>("containerControl");
            _zoomBorder       = this.Find <ZoomBorder>("zoomBorder");

            if (_projectEditor != null && _containerControl != null && _zoomBorder != null)
            {
                _projectEditor.Invalidate  = () => _containerControl.InvalidateVisual();
                _projectEditor.ResetZoom   = () => _zoomBorder.Reset();
                _projectEditor.AutoFitZoom = () => _zoomBorder.AutoFit();
                _projectEditor.LoadLayout  = () => { };
                _projectEditor.SaveLayout  = () => { };
                _projectEditor.ResetLayout = () => { };

                _zoomBorder.InvalidatedChild = InvalidateChild;
                _zoomBorder.PointerPressed  += ZoomBorder_PointerPressed;
                _zoomBorder.PointerReleased += ZoomBorder_PointerReleased;
                _zoomBorder.PointerMoved    += ZoomBorder_PointerMoved;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Detach project editor from container control.
        /// </summary>
        public void DetachEditor()
        {
            if (_projectEditor != null && _containerControl != null && _zoomBorder != null)
            {
                _projectEditor.Invalidate = null;
                _projectEditor.ResetZoom = null;
                _projectEditor.AutoFitZoom = null;
                _projectEditor.LoadLayout = null;
                _projectEditor.SaveLayout = null;
                _projectEditor.ResetLayout = null;

                _zoomBorder.InvalidatedChild = null;

                _inputProcessor.Dispose();
            }

            _projectEditor = null;
            _containerControl = null;
            _zoomBorder = null;
        }