Forum
    • Categories
    • Register
    • Login

    z-ordering issue when using drawModulationDragger/drawModulationDragBackground

    Scheduled Pinned Locked Moved Bug Reports
    20 Posts 4 Posters 90 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DanHD
      DanH @Orvillain
      last edited by

      @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?

      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
      https://dhplugins.com/ | https://dcbreaks.com/
      London, UK

      OrvillainO 1 Reply Last reply Reply Quote 0
      • OrvillainO
        Orvillain @DanH
        last edited by Orvillain

        @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.

        Musician - Instrument Designer - Sonic Architect - Creative Product Owner
        Crafting sound at every level. From strings to signal paths, samples to systems.

        DanHD 1 Reply Last reply Reply Quote 0
        • DanHD
          DanH @Orvillain
          last edited by

          @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.

          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
          https://dhplugins.com/ | https://dcbreaks.com/
          London, UK

          OrvillainO 1 Reply Last reply Reply Quote 0
          • OrvillainO
            Orvillain @DanH
            last edited by Orvillain

            @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.

            Musician - Instrument Designer - Sonic Architect - Creative Product Owner
            Crafting sound at every level. From strings to signal paths, samples to systems.

            1 Reply Last reply Reply Quote 0
            • OrvillainO
              Orvillain
              last edited by Orvillain

              @Christoph-Hart

              		// 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.

              Musician - Instrument Designer - Sonic Architect - Creative Product Owner
              Crafting sound at every level. From strings to signal paths, samples to systems.

              DanHD 1 Reply Last reply Reply Quote 0
              • DanHD
                DanH @Orvillain
                last edited by

                @Orvillain Have you tested with zoom factor? Had issues with this...

                DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                https://dhplugins.com/ | https://dcbreaks.com/
                London, UK

                OrvillainO 1 Reply Last reply Reply Quote 0
                • OrvillainO
                  Orvillain @DanH
                  last edited by Orvillain

                  @DanH Not yet actually! Potentially another good reason to just build a custom panel.

                  Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                  Crafting sound at every level. From strings to signal paths, samples to systems.

                  Christoph HartC 1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart @Orvillain
                    last edited by

                    @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 add

                    obj.alwaysOnTop = true
                    

                    and it will use the main interface as parent. Rescaling should work without issues.

                    OrvillainO 1 Reply Last reply Reply Quote 2
                    • OrvillainO
                      Orvillain @Christoph Hart
                      last edited by

                      @Christoph-Hart Lovely stuff! Thanks!

                      Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                      Crafting sound at every level. From strings to signal paths, samples to systems.

                      Christoph HartC 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @Orvillain
                        last edited by

                        @Orvillain alright, I've fixed it. I also added the default positions to the dragAreas list so that the minimal roundtrip for the getModulatorDragData function works.

                        Note that if you're manually populating the dragAreas field 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 alwaysOnTop to 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.

                        ustkU 1 Reply Last reply Reply Quote 2
                        • ustkU
                          ustk @Christoph Hart
                          last edited by

                          @Christoph-Hart awesome! I was in the same situation so 👍

                          Hise made me an F5 dude, any other app just suffers...

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          27

                          Online

                          2.3k

                          Users

                          13.6k

                          Topics

                          118.6k

                          Posts