so for better or for worse, this does seem to be the intended behavior, basically the selection toggles between the selected element and its parent. What setSelectParentIfSelected(false) prevents is having the selected object go to to the parent of the parent, etc.
You can actually look at the logic itself, it is all driven by the SelectionOperator class. You can find its implementation in the HC package (webviewer/typescript/operators/selectionOperator.ts). The relevant code is around line 156. You could use a modified version of this operator if you want to alter this behavior directly (removing the first else case of the if statement should do the trick).
This behavior does seem a bit confusing, so I’m happy to create a ticket for you in our support portal. Just let me know.
Ha, that’s awesome! I actually ended up doing something similar (although kinda hacky). However, I am not sure what would be the best way to “replace” / “intercept” the SelectionOperator or how to provide our own but only change what we need. Is there an example I can look at?
The docs go into some detail with regard to TS (link) but apparently it is not possible to convert the source code for the operators to usable JS automatically, so I ended up using chatGPT for that, which got me about 70% of the way there (had to deal with some namespace issues manually).
The code below should fix that selection issue. To use it (or replace any other operators), just do this:
let operatorid = hwv.operatorManager.registerCustomOperator(new MySelectionOperator(hwv, new Communicator.Markup.Note.NoteTextManager(hwv)))
hwv.operatorManager.replaceOperator(Communicator.OperatorId.Select,operatorid )