mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-06-13 18:58:46 +02:00
81eb8fd231
Edit mode configuration parameters are now shared between the view and the buttons in a small `OnScreenEditInfo` object, avoiding variable duplication about edit state. The `editingTouchHandler` has also been simplified to only lookup the button if one wasn't being edited already.
30 lines
679 B
Kotlin
30 lines
679 B
Kotlin
/*
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
* Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
|
*/
|
|
|
|
package emu.skyline.input.onscreen
|
|
|
|
enum class EditMode {
|
|
None,
|
|
Move,
|
|
}
|
|
|
|
/**
|
|
* A small class that holds information about the current edit session
|
|
* This is used to share information between the [OnScreenControllerView] and the individual [OnScreenButton]s
|
|
*/
|
|
class OnScreenEditInfo {
|
|
/**
|
|
* The current edit mode
|
|
*/
|
|
var editMode : EditMode = EditMode.None
|
|
|
|
/**
|
|
* The button that is currently being edited
|
|
*/
|
|
var editButton : OnScreenButton? = null
|
|
|
|
val isEditing get() = editMode != EditMode.None
|
|
}
|