Exemple #1
0
    public static Behavior GetAddDisplayObjectBehavior(string moduleName,
                                                       string elementName,
                                                       string imageUrl,
                                                       Vector2 pos,
                                                       Vector2 size,
                                                       CombineType combineType = CombineType.Independent)
    {
        Element element = new Element {
            Name    = elementName,
            X       = Element.ConvertX(pos.x),
            Y       = Element.ConvertY(pos.y),
            Width   = size.x,
            Height  = size.y,
            Visible = true
        };

        return(new Behavior(isRedo => DisplayObjectUtil.AddDisplayObjectBehavior(moduleName, element, imageUrl),
                            isReUndo => DisplayObjectUtil.RemoveDisplayObjectBehavior(moduleName, element.Name),
                            BehaviorType.AddDisplayObject,
                            true,
                            combineType));
    }