rightClickActions method
Implementation
void rightClickActions(RightClickOptions options){
switch (options) {
case RightClickOptions.cut:
widget.scene.cut();
break;
case RightClickOptions.copy:
widget.scene.copy();
break;
case RightClickOptions.paste:
widget.scene.paste();
break;
case RightClickOptions.addObject:
widget.scene.addObject(Object(
type: SelectedType.object,
name: 'Object'
));
break;
case RightClickOptions.sendToBack:
widget.scene.sendToBack();
break;
case RightClickOptions.editName:
textEdit?.open(_lastFocalPoint,scene.levelInfo[scene.selectedLevel].objects[scene.objectTappedOn.first.objectLocation].name);
break;
case RightClickOptions.changeColor:
changeColor(
context,
scene.levelInfo[scene.selectedLevel].objects[scene.objectTappedOn.first.objectLocation].color
).then((value){
if(value != null){
scene.levelInfo[scene.selectedLevel].objects[scene.objectTappedOn.first.objectLocation].changeColor(value);
}
});
break;
case RightClickOptions.bringToFront:
widget.scene.bringToFront();
break;
case RightClickOptions.addCollision:
widget.scene.addObject(Object(
type: SelectedType.collision,
name: 'Collision',
color: Colors.green.withAlpha(180),
size: const Size(50,5),
));
break;
default:
}
SelectedObjects? selectedObject = scene.objectTappedOn.isNotEmpty?scene.objectTappedOn[0]:null;
if(selectedObject != null){
switch (options) {
case RightClickOptions.remove:
scene.removeObject(selectedObject.objectLocation);
break;
case RightClickOptions.flipHorizontal:
scene.levelInfo[scene.selectedLevel].objects[selectedObject.objectLocation].flipHorizontal();
break;
case RightClickOptions.flipVertical:
scene.levelInfo[scene.selectedLevel].objects[selectedObject.objectLocation].filpVertical();
break;
default:
}
}
rightClick.closeMenu();
}