Sketcher2 source code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
868 B

package com.jotuntech.sketcher.client.command;
import java.nio.ByteBuffer;
import java.util.Deque;
import com.jotuntech.sketcher.client.Client;
import com.jotuntech.sketcher.client.Command;
import com.jotuntech.sketcher.client.Connection;
import com.jotuntech.sketcher.common.UndoEntry;
import com.jotuntech.sketcher.common.User;
public class UndoCommand implements Command {
public int perform(Client client, User user) {
if(user.isViewer()) {
return Connection.SEND_NONE;
}
Deque<UndoEntry> undoDeque = user.getUndoDeque();
if(undoDeque.size() == 0) {
return Connection.SEND_NONE;
}
UndoEntry undoEntry = undoDeque.removeFirst();
undoEntry.getLayer().undo(undoEntry.getUndoData());
return Connection.SEND_OTHERS;
}
public void decode(ByteBuffer in) {
}
public void encode(ByteBuffer out) {
}
}