@@ -455,12 +455,12 @@ function RemoteFunctions(config = {}) {
455455 _hoverHighlight . add ( element ) ;
456456 }
457457
458- // create the info box for the hovered element
459- const infoBoxHandler = LivePreviewView . getToolHandler ( "InfoBox" ) ;
460- if ( infoBoxHandler ) {
461- infoBoxHandler . dismiss ( ) ;
462- infoBoxHandler . createInfoBox ( element ) ;
463- }
458+ // commented out for unified box redesign
459+ // const infoBoxHandler = LivePreviewView.getToolHandler("InfoBox");
460+ // if (infoBoxHandler) {
461+ // infoBoxHandler.dismiss();
462+ // infoBoxHandler.createInfoBox(element);
463+ // }
464464 }
465465 }
466466
@@ -772,23 +772,24 @@ function RemoteFunctions(config = {}) {
772772
773773 // recreate UI boxes so that they are placed properly
774774 function redrawUIBoxes ( ) {
775- if ( SHARED_STATE . _toolBox ) {
776- const element = SHARED_STATE . _toolBox . element ;
777- const toolBoxHandler = LivePreviewView . getToolHandler ( "ToolBox" ) ;
778- if ( toolBoxHandler ) {
779- toolBoxHandler . dismiss ( ) ;
780- toolBoxHandler . createToolBox ( element ) ;
781- }
782- }
783-
784- if ( SHARED_STATE . _infoBox ) {
785- const element = SHARED_STATE . _infoBox . element ;
786- const infoBoxHandler = LivePreviewView . getToolHandler ( "InfoBox" ) ;
787- if ( infoBoxHandler ) {
788- infoBoxHandler . dismiss ( ) ;
789- infoBoxHandler . createInfoBox ( element ) ;
790- }
791- }
775+ // commented out for unified box redesign
776+ // if (SHARED_STATE._toolBox) {
777+ // const element = SHARED_STATE._toolBox.element;
778+ // const toolBoxHandler = LivePreviewView.getToolHandler("ToolBox");
779+ // if (toolBoxHandler) {
780+ // toolBoxHandler.dismiss();
781+ // toolBoxHandler.createToolBox(element);
782+ // }
783+ // }
784+
785+ // if (SHARED_STATE._infoBox) {
786+ // const element = SHARED_STATE._infoBox.element;
787+ // const infoBoxHandler = LivePreviewView.getToolHandler("InfoBox");
788+ // if (infoBoxHandler) {
789+ // infoBoxHandler.dismiss();
790+ // infoBoxHandler.createInfoBox(element);
791+ // }
792+ // }
792793 }
793794
794795 // redraw active highlights
@@ -1140,7 +1141,25 @@ function RemoteFunctions(config = {}) {
11401141 _handleConfigurationChange ( ) ;
11411142 }
11421143
1144+ // Preserve the currently selected element across re-registration
1145+ // so that toggling options (e.g. show measurements, show spacing handles)
1146+ // doesn't clear the element highlighting.
1147+ const selectedBeforeReregister = previouslySelectedElement ;
11431148 registerHandlers ( ) ;
1149+ if ( ! isModeChanged && ! highlightModeChanged && selectedBeforeReregister
1150+ && config . mode === 'edit' ) {
1151+ // Restore the click highlight for the previously selected element
1152+ if ( ! _clickHighlight ) {
1153+ _clickHighlight = new Highlight ( true ) ;
1154+ }
1155+ _clickHighlight . add ( selectedBeforeReregister ) ;
1156+ previouslySelectedElement = selectedBeforeReregister ;
1157+ window . __current_ph_lp_selected = selectedBeforeReregister ;
1158+ // Restore the outline
1159+ const isEditable = selectedBeforeReregister . hasAttribute ( GLOBALS . DATA_BRACKETS_ID_ATTR ) ;
1160+ const outlineColor = isEditable ? COLORS . outlineEditable : COLORS . outlineNonEditable ;
1161+ selectedBeforeReregister . style . outline = `1px solid ${ outlineColor } ` ;
1162+ }
11441163 return JSON . stringify ( config ) ;
11451164 }
11461165
0 commit comments