z-ordering issue when using drawModulationDragger/drawModulationDragBackground
-
@DanH said in z-ordering issue when using drawModulationDragger/drawModulationDragBackground:
@Orvillain because my draggers (depth knobs) are always visible. All of them. So if I switch panels then the draggers still sit on top of the new panel. Make sense?
Yeah that makes sense. I think I might’ve been tempted to handle it a bit more locally rather than adjust the framework, it seems a bit sledgehammery to me, because I think the majority expected behaviour is that these mod depth knobs always sit on top of everything, and disappear when you move the mouse away. But that’s just my instinct. Interested to hear your thinking.
-
@Orvillain There should probably be an option for either. There's also the labels to think about as well... It's not a one size fits all solution.
-
@DanH said in z-ordering issue when using drawModulationDragger/drawModulationDragBackground:
@Orvillain There should probably be an option for either. There's also the labels to think about as well... It's not a one size fits all solution.
I just found another issue too - when you have your knobs inside a panel, that panel can easily clip off the floating popup for these depth knobs.... which is kind of annoying. Maybe the best solution for me actually IS to write a custom script panel that knows what knob we are hoving over, and assigns the depth knobs dynamically.
-
// Walk up to the top-level component to avoid clipping by // intermediate parent containers (e.g. panel areas). if(auto pp = parent->getParentComponent()) { // Convert drag areas and label from parent-relative to top-level-relative coords auto topLevel = parent->getTopLevelComponent(); auto parentOriginInTop = pp->getLocalPoint(topLevel, juce::Point<int>(0, 0)) * -1; dragAreas.offsetAll(parentOriginInTop.x, parentOriginInTop.y); if(!labelArea.isEmpty()) labelArea.translate(parentOriginInTop.x, parentOriginInTop.y); topLevel->addAndMakeVisible(this, -1); }For my usage, I had to change to the code above.
I think we need the Z-order to be dynamic. But I also think the parenting strategy needs to be dynamic. Either DirectParent, or TopLevel. How easy would that be to add?
DirectParent == current behaviour, where you want a container panel to clip the hover panel.
TopLevel == popup always floats about everything; probably correct for 99% of use cases. -
@Orvillain Have you tested with zoom factor? Had issues with this...
-
@DanH Not yet actually! Potentially another good reason to just build a custom panel.
-
@Orvillain yup, reasonable request. I'll add a field to the obj that you create with
getModulatorDragData()(or whatever it's called), then you just addobj.alwaysOnTop = trueand it will use the main interface as parent. Rescaling should work without issues.
-
@Christoph-Hart Lovely stuff! Thanks!
-
@Orvillain alright, I've fixed it. I also added the default positions to the
dragAreaslist so that the minimal roundtrip for thegetModulatorDragDatafunction works.Note that if you're manually populating the
dragAreasfield with your custom position (as eg. the MatrixModulator tutorial snippet does), your custom positions will still prevail - it detects a mismatch between the number of sources to display and the given areas and picks the ones at the end of the list (since they will most likely the ones you tucked onto the already populated list).The minimal example that shows the functionality is this. flip
alwaysOnTopto true, then it will not be truncated by the parent (or hidden by sibling components). default is false for backwards compatibility.const var p = Content.addPanel("P1", 100, 100) p.set("width", 200); p.set("height", 60); const var k = Content.addKnob("Knob1", 50, 5); k.set("parentComponent", "P1"); const var laf = Content.createLocalLookAndFeel(); laf.registerFunction("getModulatorDragData", function(obj) { // set to true to make it not being clipped by the parent panel obj.alwaysOnTop = false; Console.print(obj.id); // bonus: you get the ID of the slider now too... obj.labelArea[2] += 10; // lol default width truncates label... return obj; }); k.setLocalLookAndFeel(laf);Let me know if there are any glitches - I had to fiddle around with the code until it respected nested parent structures, but rescaling, parentComponents etc. should all work consistently now.
-
@Christoph-Hart awesome! I was in the same situation so
