-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add click on canvas to jumpToEntry in multi-edit mode #49
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,7 +125,15 @@ fun MarkerPointEventContainer( | |
) | ||
} | ||
.onPointerEvent(PointerEventType.Press) { event -> | ||
state.handleMousePress(tool, keyboardState, event, state.labelerConf, appState.appConf, screenRange) | ||
state.handleMousePress( | ||
tool, | ||
keyboardState, | ||
event, | ||
state.labelerConf, | ||
appState.appConf, | ||
screenRange, | ||
editorState, | ||
) | ||
} | ||
.onPointerEvent(PointerEventType.Release) { event -> | ||
state.handleMouseRelease( | ||
|
@@ -583,9 +591,10 @@ private fun MarkerState.handleMousePress( | |
labelerConf: LabelerConf, | ||
appConf: AppConf, | ||
screenRange: FloatRange?, | ||
editorState: EditorState, | ||
) { | ||
when (tool) { | ||
Tool.Cursor -> handleCursorPress(keyboardState, event, labelerConf, appConf) | ||
Tool.Cursor -> handleCursorPress(keyboardState, event, labelerConf, appConf, editorState) | ||
Tool.Scissors -> Unit | ||
Tool.Pan -> handlePanPress(event) | ||
Tool.Playback -> handlePlaybackPress(keyboardState, screenRange, event) | ||
|
@@ -597,6 +606,7 @@ private fun MarkerState.handleCursorPress( | |
event: PointerEvent, | ||
labelerConf: LabelerConf, | ||
appConf: AppConf, | ||
editorState: EditorState, | ||
) { | ||
val action = keyboardState.getEnabledMouseClickAction(event) ?: return | ||
if (action.canMoveParameter()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to add another Also, it might be better UX if we handle it on mouse release (up), not mouse press (down). Even if we use another |
||
|
@@ -619,6 +629,15 @@ private fun MarkerState.handleCursorPress( | |
val forcedDrag = action == MouseClickAction.MoveParameterIgnoringConstraints | ||
cursorState.update { startDragging(lockedDrag, withPreview, forcedDrag) } | ||
} | ||
if (appConf.editor.clickToSwitchCurrentIndex) { | ||
cursorStateValue.position?.let { position -> | ||
getEntryIndexByCursorPosition(position)?.let { index -> | ||
// having bugs here | ||
// if the cursor do not move, it would not jump | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean, when only clicking and without any moving, this line is not executed? |
||
editorState.jumpToEntry(editorState.project.currentModule.name, index) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -474,6 +474,8 @@ fun Strings.en(): String = when (this) { | |
PreferencesEditor -> "Editor" | ||
PreferencesEditorDescription -> "Customize the editor's appearance and behavior." | ||
PreferencesEditorPlayerCursorColor -> "Player cursor color" | ||
PreferencesEditorClickToJumToEntry -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: |
||
"Jump to the cursor position entry by clicking it on canvas in multiple entry edit mode" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
PreferencesEditorLockedDrag -> "Fixed-drag" | ||
PreferencesEditorLockedDragDescription -> | ||
"Select a condition to enable fixed-drag while you move " + | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's place it over the color.