public IVObjectAction this[int actionId] { get { IVObjectAction result = null; foreach (IControlPointsProvider provider in _host.ControlPointsProviders) { if (provider.SupportedActions.Contains(actionId)) { result = provider.SupportedActions[actionId]; break; } } return(result); } }
private void UpdateControlPointsState() { bool enableResize = true, enableSkew = true, enableRotate = true, enableDrag = true; ResizeMode resizeMode = ResizeMode.Arbitrary; foreach (IVObject obj in _children) { IControlPointsProvider icpp = obj as IControlPointsProvider; if (icpp != null) { // Updating resize options IVObjectAction action = icpp.SupportedActions[VObjectAction.Resize]; if (_multipleVObjectsTransformationEnabled && action != null) { enableResize &= action.Enabled; if (((ResizeVObjectAction)action).ResizeMode == ResizeMode.None) { resizeMode = ResizeMode.None; } if (resizeMode != ResizeMode.None && ((ResizeVObjectAction)action).ResizeMode == ResizeMode.Proportional) { resizeMode = ResizeMode.Proportional; } } else { enableResize = false; } // And skew options action = icpp.SupportedActions[VObjectAction.Skew]; if (_multipleVObjectsTransformationEnabled && action != null) { enableSkew &= action.Enabled; } else { enableSkew = false; } // And rotations options action = icpp.SupportedActions[VObjectAction.Rotate]; if (_multipleVObjectsTransformationEnabled && action != null) { enableRotate &= action.Enabled; } else { enableRotate = false; } // And rotations options action = icpp.SupportedActions[VObjectAction.Drag]; if (action != null) { enableDrag &= action.Enabled; } else { enableDrag = false; } } else { enableResize = false; enableSkew = false; enableRotate = false; } } this.SupportedActions[VObjectAction.Rotate].Enabled = enableRotate; this.SupportedActions[VObjectAction.Skew].Enabled = enableSkew; this.SupportedActions[VObjectAction.Resize].Enabled = enableResize; this.SupportedActions[VObjectAction.Drag].Enabled = enableDrag; ((ResizeVObjectAction)this.SupportedActions[VObjectAction.Resize]).ResizeMode = resizeMode; }