public ScaleKeysCommand(CurveEditorControl2 control, Point min, Point max, ScaleBoxHandle handle) : base(control) { // Store the parameters. _min = min; _max = max; _newMin = min; _newMax = max; _handle = handle; // Store the current selection, if any. _affectedKeys = new long[control.Selection.Count]; _normalizedPos = new Point[control.Selection.Count]; var i = 0; foreach (var key in control.Selection) { _affectedKeys[i] = key.Id; var pos = key.GetPosition(); _normalizedPos[i].X = (pos.X - min.X) / (max.X - min.X); _normalizedPos[i].Y = (pos.Y - min.Y) / (max.Y - min.Y); i++; } }
/// <summary> /// Creates a new command to scale a set of keys. /// </summary> /// <param name="min">The minimum position of the scale box grabbing all selected keys</param> /// <param name="max">The maximum position of the scale box grabbing all selected keys</param> public ScaleKeysCommand(CurveEditorControl2 control, Point min, Point max, ScaleBoxHandle handle) : base(control) { // Store the parameters. this.min = min; this.max = max; this.newMin = min; this.newMax = max; this.handle = handle; // Store the current selection, if any. affectedKeys = new long[control.Selection.Count]; normalizedPos = new Point[control.Selection.Count]; int i = 0; foreach (KeyWrapper key in control.Selection) { affectedKeys[i] = key.Id; Point pos = key.GetPosition(); normalizedPos[i].X = (pos.X - min.X) / (max.X - min.X); normalizedPos[i].Y = (pos.Y - min.Y) / (max.Y - min.Y); i++; } }
public ScaleKeysCommand(CurveEditorControl2 control, Point min, Point max, ScaleBoxHandle handle) : base(control) { // Store the parameters. _min = min; _max = max; _newMin = min; _newMax = max; _handle = handle; // Store the current selection, if any. _affectedKeys = new long[control.Selection.Count]; _normalizedPos = new Point[control.Selection.Count]; var i = 0; foreach (var key in control.Selection) { _affectedKeys[i] = key.Id; var pos = key.GetPosition(); _normalizedPos[i].X = (pos.X - min.X) / (max.X - min.X); _normalizedPos[i].Y = (pos.Y - min.Y) / (max.Y - min.Y); i++; } }