Chart - Fix notekinds changing on multi select

Also reverts a change by this author that caused selected events to be reset when the event toolbox is first opened.
This commit is contained in:
Lasercar
2025-12-10 00:43:12 -05:00
committed by Hundrec
parent d3c16b45c6
commit 5a2c364c50
3 changed files with 21 additions and 10 deletions
@@ -114,10 +114,7 @@ class ChartEditorToolboxHandler
{
var toolbox:Null<ChartEditorBaseToolbox> = cast state.activeToolboxes.get(id);
if (toolbox == null)
{
toolbox = cast initToolbox(state, id);
}
if (toolbox == null) return;
if (toolbox != null)
{
@@ -68,13 +68,12 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
if (noteKind == '~CUSTOM~')
{
showCustom();
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
chartEditorState.noteKindToPlace = toolboxNotesCustomKind.value;
}
else
{
hideCustom();
chartEditorState.noteKindToPlace = noteKind;
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
}
createNoteKindParams(noteKind);
@@ -112,14 +111,20 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
chartEditorState.notePreviewDirty = true;
}
};
var startingValueNoteKind = ChartEditorDropdowns.populateDropdownWithNoteKinds(toolboxNotesNoteKind, '');
toolboxNotesNoteKind.pauseEvent(UIEvent.CHANGE, true);
var startingValueNoteKind = ChartEditorDropdowns.populateDropdownWithNoteKinds(toolboxNotesNoteKind, chartEditorState.noteKindToPlace);
toolboxNotesNoteKind.value = startingValueNoteKind;
toolboxNotesNoteKind.resumeEvent(UIEvent.CHANGE, true, true);
toolboxNotesCustomKind.onChange = function(event:UIEvent) {
var customKind:Null<String> = event?.target?.text;
chartEditorState.noteKindToPlace = customKind;
if (chartEditorState.currentEventSelection.length > 0)
if (toolboxNotesNoteKind.value.id != '~CUSTOM~') return;
if (!_initializing && chartEditorState.currentNoteSelection.length > 0)
{
// Edit the note data of any selected notes.
for (note in chartEditorState.currentNoteSelection)
@@ -131,13 +136,21 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
chartEditorState.notePreviewDirty = true;
}
};
toolboxNotesCustomKind.pauseEvent(UIEvent.CHANGE, true);
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
toolboxNotesCustomKind.resumeEvent(UIEvent.CHANGE, true, true);
}
public override function refresh():Void
{
super.refresh();
toolboxNotesNoteKind.pauseEvent(UIEvent.CHANGE, true);
toolboxNotesCustomKind.pauseEvent(UIEvent.CHANGE, true);
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
toolboxNotesNoteKind.value = ChartEditorDropdowns.lookupNoteKind(chartEditorState.noteKindToPlace);
if (toolboxNotesNoteKind.value.id == '~CUSTOM~' && chartEditorState.noteKindToPlace != null)
{
@@ -147,9 +160,10 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
{
hideCustom();
}
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
createNoteKindParams(chartEditorState.noteKindToPlace);
toolboxNotesNoteKind.resumeEvent(UIEvent.CHANGE, true, true);
toolboxNotesCustomKind.resumeEvent(UIEvent.CHANGE, true, true);
}
function showCustom():Void
@@ -236,7 +236,7 @@ class ChartEditorDropdowns
{
dropDown.dataSource.clear();
var returnValue:DropDownEntry = lookupNoteKind('');
var returnValue:DropDownEntry = lookupNoteKind(startingKindId);
for (noteKindId in NOTE_KINDS.keys())
{