-
Notifications
You must be signed in to change notification settings - Fork 22
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 border highlight in multi-edit mode #50
base: main
Are you sure you want to change the base?
Add border highlight in multi-edit mode #50
Conversation
…long with chinese translations
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.
This feature is almost done! Thank you very much, it's a very nice idea.
Please check the comments I left.
@@ -313,12 +313,40 @@ private fun FieldBorderCanvas( | |||
state.getEntryIndexesByBorderIndex(pointIndex).second == entryIndex | |||
) 1f else IDLE_LINE_ALPHA | |||
if (border in screenRange) { | |||
var strokeWidth: Float = STROKE_WIDTH | |||
var color = borderColor.copy(alpha = borderLineAlpha) | |||
if (editorConf.highlightCurrentEntryBorder) { |
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 add some checks about multiple edit mode here.
} | ||
} | ||
// when dragging, the highlight border would glitch, but I have no idea how to fix that | ||
if (editorConf.highlightCursorPositionEntryBorder) { |
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.
The most simple fix:
if (editorConf.highlightCursorPositionEntryBorder) { | |
if (editorConf.highlightCursorPositionEntryBorder && | |
cursorState.value.mouse != MarkerCursorState.Mouse.Dragging | |
) { |
But this will cause the highlight to disappear when dragging.
So if we want it perfectly, we need to add a previousPositionBeforeDragging
nullable field in MarkerCursorState
:
- in
startDragging
, copy theposition
value topreviousPositionBeforeDragging
- during dragging, do not change it
- in
finishDragging
, clear it - when drawing the highlight, get the position according to the
mouse
type. If it's dragging, usepreviousPositionBeforeDragging
, otherwise, useposition
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.
Um, I think I was wrong.
Even if we remember the cursor position before we start dragging, the borders are changing, causing the entry selected also changing.
So we probably should instead remember a relative offset of the clicked position and the parameter line being dragged, so when rendering the lines, we can get a stable cursor position.
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.
I got it working. Please have a look! (It's a git patch, if you don't now how to apply it please Google or GPT)
@@ -488,6 +488,16 @@ fun Strings.zhHans(): String? = when (this) { | |||
PreferencesEditorContinuousLabelNamesEditableBackgroundColor -> "背景色(编辑中)" | |||
PreferencesEditorContinuousLabelNamesSize -> "大小" | |||
PreferencesEditorContinuousLabelNamesPosition -> "位置" | |||
PreferencesEditorBorderHighlight -> "边界高亮" | |||
PreferencesEditorBorderHighlightDescription -> "编辑在多条目编辑模式中边界高亮等的设置" |
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.
Please add a period.
updater = { copy(editor = it) }, | ||
) { | ||
|
||
switch( |
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.
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.
Also I feel like the default color/width settings should be inverted.
The cursor should have the highest visual priority.
@@ -547,6 +547,18 @@ fun Strings.en(): String = when (this) { | |||
PreferencesEditorContinuousLabelNamesEditableBackgroundColor -> "Background color (editing)" | |||
PreferencesEditorContinuousLabelNamesSize -> "Size" | |||
PreferencesEditorContinuousLabelNamesPosition -> "Position" | |||
PreferencesEditorBorderHighlight -> "Border Highlight" | |||
PreferencesEditorBorderHighlightDescription -> "Customize border highlighting in multiple entry edit mode" |
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.
Please add a period.
Ah, for the format error, you can run |
I add highlight feature and its customization in preferences page. You could highlight the border current entry and cursor position entry in the change. Also, the color and width of the highlight border could be customize.
Currently, if you enable cursor position highlight and try to drag the parameter, it would glitch, jump back and forth between the nearby entry boder. I am sorry that my PRs are full of bugs.