JumperOnJava / JumpersPizzeria

GNU General Public License v3.0
3 stars 1 forks source link

Suggestion - adding a pizza action shouldn't delete the previous action #8

Open AdamBrezik opened 1 year ago

AdamBrezik commented 1 year ago

Hello,

This is a suggestion for the situation when you're adding new actions by clicking on an action right mouse to split it in twine. Currently this deletes the item, creating 2 empty items. My suggestion is that first of the items retains the parameters of the item that is currently being deleted.

Kind regards,

Aidee

JumperOnJava commented 1 year ago

I don't really remember how this part is implemented so it may be eary or hard. Thanks for the suggestion btw, i will try to make it as soon as possible

ginsm commented 2 months ago

This would be very convenient

AdamBrezik commented 2 months ago

Well, I couldn't even find the part. To be honest, I'd love your code to have more comments.

ginsm commented 2 months ago

The split happens here EntirePizzaConfiguratorScreen#122. I think I managed to get it to work, where the previous action remains, with this code:

public void splitSlice(ConfigurablePizzaSlice clickedSlice) {
    CircleSlice circleSlice = clickedSlice.getSlice();

    editSlices.add(new RunnableSlice("Empty action", new CircleSlice(circleSlice.getMidAngle(), circleSlice.endAngle),clickedSlice.getManager()));

    // Updates the clickedSlice's CircleSlice in place
    ((RunnableSlice) clickedSlice).setSlice(
        new CircleSlice(circleSlice.startAngle, circleSlice.getMidAngle())
    );

    rebuildSlices();
}

It seems to be working without issue, anyway: https://youtu.be/R-nJYxt1qXU