Issue with svg images integrated through xml hotspot rendering black

  • Regards everyone,

    We are using krpano for quite some years now, and recently in one of our use case we noticed a strange behavior.

    SVG files are rendered in black, on code implementation who worked perfectly fine for years. We think the issue is due to a recent update of chromium-based browsers, but its just a speculation.

    We use svg images to decorate hotspots via tour.xml, embedded in <scene> tag, for example :

    Code
    <hotspot devices="desktop.and.!firefox" name="picto_banques" style="picto_banques" ath="5" atv="19" />

    and the associated style definition in vtourskin.xml :

    Code
    <style name="picto_banques" url="pictos/png/picto_banques.png" height="7.5%" width="prop" edge="bottom left" distorted="false"
    		tooltip=""
    		linkedscene=""
    		linkedscene_lookat=""
    		rx="0"
    		onclick=""
    		onover="tween(height,7.7%);"
    		onout="tween(height,7.5%);"
    		onloaded="if(linkedscene AND skin_settings.tooltips_hotspots, copy(tooltip,scene[get(linkedscene)].title); loadstyle(skin_tooltips); );"
    		/>

    On the same krpano code we use a custom script (in krpano script) who create dynamically hotspots from a list, with svg decoration (via url property), who are working perfectly fine.

    Here is an exemple : https://www.visiolab.fr/Panorama/_test/

    Any clue anyone ?

    Thank you for reading,

    Xavier

  • Hi, thanks for your advice.

    I did rebuild the application with v1.23.3

    The issue still the same, however i think i find the problem, it seems related to the presence/absence of the width and height attributes on the root tag of the svg file content

    You can see in this example, you should see three blue labels but only one displays properly (on chromium based browsers) : https://www.visiolab.fr/Panorama/_test2/

    The one svg displaying well got width and height attributes defined :

    Code
    <svg id="Calque_1" data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 303.85 54.36" width="304" height="55">

    in opposition of the two others

    Code
    <svg id="Calque_1" data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 338.26 52.36"> 

    We used to serve the last type of svg ('responsive') for chromium based browsers, due to a better, thiner drawing (a matter of scaling / rendering order of the svg display imo)

    However, the dynamic hotspots we create are still displaying well with undeclared width/height svg files (the pictograms with icons in my example), and that is what leaves me perplex about it.

    Nevertheless the issue is recent

    I'm gonna investigate further with svg files syntax compatibility with chrome overall

    • New
    • Official Post

    The issue still the same, however i think i find the problem, it seems related to the presence/absence of the width and height attributes on the root tag of the svg file content

    This is a common browser issue - SVG files without explizit size often cause problems. The exact behavior depends on the browser. Some browsers uses fallbacks by using the viewbox as size-source, others just use size 0, which then makes the images invisibly small...

    krpano is loading the SVG files as images, so it depends on the browser behavior. And there is also a difference if that image will be uploaded as texture (WebGL hotspot rendering) or insert into the HTML-DOM as CSS3D-rendered hotspot.

    So for a consistent behavior it would be good, that each SVG file has width/height settings inside it.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!