Package org.joshy.sketch.actions.symbols

Source Code of org.joshy.sketch.actions.symbols.CreateSymbol

package org.joshy.sketch.actions.symbols;

import org.joshy.sketch.modes.vector.VectorDocContext;
import org.joshy.sketch.actions.SAction;
import org.joshy.sketch.model.SNode;

import static org.joshy.gfx.util.localization.Localization.getString;

public class CreateSymbol extends SAction {
    private VectorDocContext context;

    public CreateSymbol(VectorDocContext context) {
        this.context = context;
    }


    @Override
    public CharSequence getDisplayName() {
        return getString("menus.createSymbol");
    }

    @Override
    public void execute() {
        if(context.getSelection().isEmpty()) return;
        if(context.getSelection().size() > 1) return;

        SNode shape = context.getSelection().items().iterator().next();
        SNode dupe = shape.duplicate(null);
        dupe.setTranslateX(0);
        dupe.setTranslateY(0);

        context.getSymbolManager().add(dupe);
        //context.getSymbolManager().save();
    }
}
TOP

Related Classes of org.joshy.sketch.actions.symbols.CreateSymbol

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.