Exemplo n.º 1
0
        public void ScaleAt(float scaleX, float scaleY, Vex.Point center)
        {
            scaleX = (Math.Abs(scaleX) < .01) ? .01f : scaleX;
            scaleY = (Math.Abs(scaleY) < .01) ? .01f : scaleY;

            Matrix tm = TransformMatrix.Clone();

            tm.Translate(-TransformMatrix.OffsetX, -TransformMatrix.OffsetY, MatrixOrder.Append);
            Matrix itm = tm.Clone();

            itm.Invert();

            foreach (uint id in list)
            {
                DesignInstance inst = instanceManager[id];

                using (Matrix ms = inst.GetMatrix().SysMatrix())
                {
                    ms.Translate(-center.X, -center.Y, MatrixOrder.Append);
                    ms.Multiply(itm, MatrixOrder.Append);
                    ms.Scale(scaleX, scaleY, MatrixOrder.Append);
                    ms.Multiply(tm, MatrixOrder.Append);
                    ms.Translate(center.X, center.Y, MatrixOrder.Append);

                    inst.SetMatrix(ms.VexMatrix());
                }
            }
            tm.Dispose();
            itm.Dispose();

            transformMatrix.ScaleAt(scaleX, scaleY, center.SysPointF());
            isDirty = true;
            MainForm.CurrentStage.InvalidateTransformedSelection();
        }
Exemplo n.º 2
0
        private void TranslateElement(uint id, float newBoundsLeft, float newBoundsTop)
        {
            DesignInstance inst = instanceManager[id];

            using (Matrix mr = inst.GetMatrix().SysMatrix())
            {
                mr.Translate(newBoundsLeft - inst.StrokeBounds.Left, newBoundsTop - inst.StrokeBounds.Top, MatrixOrder.Append);
                inst.SetMatrix(mr.VexMatrix());
            }

            isDirty = true;
        }
Exemplo n.º 3
0
        public void RotateAt(float angle, Vex.Point center)
        {
            foreach (uint id in list)
            {
                DesignInstance inst = instanceManager[id];
                using (Matrix mr = inst.GetMatrix().SysMatrix())
                {
                    mr.RotateAt(angle, center.SysPointF(), MatrixOrder.Append);
                    inst.SetMatrix(mr.VexMatrix());
                }
            }

            transformMatrix.RotateAt(angle, center.SysPointF(), MatrixOrder.Append);
            isDirty = true;
            MainForm.CurrentStage.InvalidateTransformedSelection();
        }