public CompartmentDragMouseAction(ModelElement sourceChildElement, EnumShape sourceParentShape, RectangleD bounds)
     : base(sourceParentShape.Diagram)
 {
     sourceChild             = sourceChildElement;
     sourceShape             = sourceParentShape;
     sourceCompartmentBounds = bounds; // For cursor.
 }
예제 #2
0
        public override void ElementAdded(ElementAddedEventArgs e)
        {
            base.ElementAdded(e);

            EnumShape   element   = (EnumShape)e.ModelElement;
            Store       store     = element.Store;
            Transaction current   = store.TransactionManager.CurrentTransaction;
            ModelRoot   modelRoot = store.ModelRoot();

            if (current.IsSerializing || ModelRoot.BatchUpdating)
            {
                return;
            }

            // if the diagram we're adding to isn't the current visible diagram, add the shape but don't show it
            Diagram currentDiagram = ModelRoot.GetCurrentDiagram?.Invoke();

            if (element.Diagram != currentDiagram)
            {
                element.Hide();
            }
        }