HISE Logo Forum
    • Categories
    • Register
    • Login

    WebView Not Scaling With Zoom Factor

    Scheduled Pinned Locked Moved Bug Reports
    19 Posts 8 Posters 2.1k 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.
    • Casey KolbC
      Casey Kolb @Christoph Hart
      last edited by

      @Christoph-Hart Excellent! I'll try it out.

      Casey Kolb
      Founder & CEO of Lunacy Audio
      Composer | Producer | Software Developer

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

        @Casey-Kolb Actually I found a better fix - the previous one was relying on a timer delay which might work, but now it's much more reliable because it executes the scale factor update when the DOM is loaded.

        Let me know if that's better. I need to test this on Windows tomorrow, but on macOS it's much more stable IMHO.

        Casey KolbC 1 Reply Last reply Reply Quote 1
        • Casey KolbC
          Casey Kolb @Christoph Hart
          last edited by

          @Christoph-Hart Yep, this worked like a charm on Mac.

          Casey Kolb
          Founder & CEO of Lunacy Audio
          Composer | Producer | Software Developer

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

            One thing I noticed is that now you cannot use window.innerWidth / window.innerHeight in your JS code anymore as this will be initialized correctly once but will not be updated correctly when the scale factor changes. Instead, just use the actual size of the webview as fixed pixel value, then it works.

            BrianB 1 Reply Last reply Reply Quote 1
            • BrianB
              Brian @Christoph Hart
              last edited by

              @Christoph-Hart quick side question , if we have audio being streamed via the browser from a web url source ( context being able to preview a demo of a sound etc.) I am assuming that this will not play through HISE. Might there be a way to be able to set this via scripting ? :)

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

                @Brian Getting access to the webviews audio output is not possible but if it's just for streaming a demo track you could just call a HISE function from your JS that will download the particular file and start previewing it.

                Webview code:

                <button onclick='onPreview("beat.wav")'>Preview</button>
                
                <div id="valueDisplay">This will show the preview progress</div>
                
                <script>
                window.onFileLoad = function(message)
                {
                  document.getElementById("valueDisplay").innerHTML = message;
                }
                </script>
                

                HISE:

                inline function playFile(f)
                {
                	local channels = f.loadAsAudioFile();
                				
                	for(c in channels)
                		c *= 0.125; // apply -12dB gain
                		
                	Engine.playBuffer(channels, function(args, obj){
                		wv.callFunction("onFileLoad", "Position: " + obj);
                	}, f.loadAudioMetadata().SampleRate);
                }
                
                function onPreview(args)
                {
                	Server.setBaseURL("https://hise.audio");
                	
                	var f = FileSystem.getFolder(FileSystem.Desktop).getChildFile(args[0]);
                	
                	if(f.isFile())
                	{
                		playFile(f);
                	}
                	else
                	{
                		Server.downloadFile(args[0], {}, f, function [f]()
                		{
                			var message = "Downloading ";
                			
                			message += Engine.doubleToString(this.data.numDownloaded / 1024.0 / 1024.0, 1);
                		    message += "MB / " + Engine.doubleToString(this.data.numTotal / 1024.0 / 1024.0, 1) + "MB";
                		    
                		    wv.callFunction("onFileLoad", message);
                		     
                		    if(this.data.finished && this.data.success)
                				playFile(f);
                		});
                	}
                }
                
                wv.bindCallback("previewFile", onPreview);
                
                BrianB 1 Reply Last reply Reply Quote 1
                • BrianB
                  Brian @Christoph Hart
                  last edited by

                  @Christoph-Hart thank you! That should do the job just perfectly! We'll report back on how this goes :)

                  1 Reply Last reply Reply Quote 0
                  • StraticahS
                    Straticah @Casey Kolb
                    last edited by Straticah

                    @Casey-Kolb @Christoph-Hart I am running into this exact issue.

                    Webview is initialized "hidden" since its in a panel.

                    Does not save applied scale factor when re-opening VST:

                    2c46a619-318e-400f-b86a-1c8030d34a68-image.png

                    Any help? Same issue tested on "WebViewTests Preset browser"
                    scaleFactorToZoom = enabled
                    fixed pixel size used for both

                    88bbfc2f-b664-43c3-8128-e5f110881233-image.png

                    Edit: Is it possible to manually scale webview so i could rescale on popup toggle?

                    creating user interfaces: www.vst-design.com
                    founder @prototype.audio https://www.prototype.audio/

                    StraticahS 1 Reply Last reply Reply Quote 0
                    • StraticahS
                      Straticah @Straticah
                      last edited by

                      @Christoph-Hart
                      Any minimal snippet/example on how to make one of the HISE examples retain scale factor?
                      Open/close in DAW resets back to 100% same goes for F5 in HISE.

                      creating user interfaces: www.vst-design.com
                      founder @prototype.audio https://www.prototype.audio/

                      HISEnbergH 1 Reply Last reply Reply Quote 0
                      • HISEnbergH
                        HISEnberg @Straticah
                        last edited by

                        @Straticah Hey did you find a solution for this? I am looking into this as well? Also how is your webview-based preset browser coming along? I want to dive into this myself but I am worried about potential bugs cropping up then being stuck.

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

                        22

                        Online

                        2.0k

                        Users

                        12.6k

                        Topics

                        109.7k

                        Posts