コード例 #1
0
        public void DragPoint(int index, System.Drawing.PointF newPosition)
        {
            if (index < 0 || index > 3)
            {
                throw new System.ArgumentOutOfRangeException("index");
            }

            UpdateInverseMatrix();
            System.Drawing.PointF newBasePoint = newPosition;
            VObjectsUtils.TransformPoint(_objInverseMatrix, ref newBasePoint);

            System.Drawing.PointF scaleRefPoint = GetScaleRefPoint(index);
            float dx = Math.Sign(_points[index].X - scaleRefPoint.X) * (newBasePoint.X - _points[index].X);
            float dy = Math.Sign(_points[index].Y - scaleRefPoint.Y) * (newBasePoint.Y - _points[index].Y);

            System.Drawing.RectangleF newBounds = VObjectsUtils.GetBoundingRectangle(newBasePoint, scaleRefPoint);
            if (newBounds.Width < 1 || newBounds.Height < 1)
            {
                return;
            }

            if (_obj.TextArea.Height + dy < 0)
            {
                _flipY = !_flipY;
            }
            if (_obj.TextArea.Width + dx < 0)
            {
                _flipX = !_flipX;
            }

            _obj.TextArea = newBounds;
        }
コード例 #2
0
        private void UpdateControlPoints()
        {
            if (_updateControlPoints)
            {
                UpdateBaseRectanglePoints();

                System.Drawing.PointF[] interim = VObjectsUtils.TransformPoints(_obj.Transform, _points);
                for (int i = 0; i < _transformedPoints.Count; i++)
                {
                    _transformedPoints[i].Location = interim[i];
                }

                _updateControlPoints = false;
            }
        }
コード例 #3
0
        private void LayerRemovedHandler(object sender, LayerRemovedEventArgs e)
        {
            if (e.Layer == _currentLayer)
            {
                if (_layers.Count > 0)
                {
                    int newIndex = e.Index - 1;
                    ChangeCurrentLayer(_layers[VObjectsUtils.FitToBounds(newIndex, 0, _layers.Count - 1)]);
                }
                else
                {
                    ChangeCurrentLayer(null);
                }
            }

            if (_hostViewer != null)
            {
                _hostViewer.InvalidateViewer();
            }
        }