Example #1
0
        /// <summary>
        /// Move the core handle and if present also the slave handles in a way that the control point triple is collinear.
        /// </summary>
        public void HandleMove(IInputModeContext context, PointD originalLocation, PointD newLocation)
        {
            var delta = newLocation - originalLocation;

            coreHandle.HandleMove(context, originalLocation, newLocation);
            if (firstSlaveHandle != null)
            {
                firstSlaveHandle.HandleMove(context, firstOrigin, firstOrigin + delta);
            }
            if (lastSlaveHandle != null)
            {
                lastSlaveHandle.HandleMove(context, lastOrigin, lastOrigin + delta);
            }
        }
Example #2
0
        /// <summary>
        /// Move the core handle and if present also the slave handle in a way that the control point triple is collinear.
        /// </summary>
        public void HandleMove(IInputModeContext context, PointD originalLocation, PointD newLocation)
        {
            coreHandle.HandleMove(context, originalLocation, newLocation);

            if (slaveHandle != null)
            {
                //If necessary, rotate the slave handle
                //Move the other one by the point reflection of our move delta, keeping its distance, though
                var delta = newLocation - middleLocation;
                //The distance of the slave handle - we keep this
                var otherDist = (slaveOrigin - middleLocation).VectorLength;
                //We can use the original context since we have already done all decisions in InitializeDrag
                slaveHandle.HandleMove(context, slaveOrigin, middleLocation - delta.Normalized * otherDist);
            }
        }