Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Christian A 24 posts 98 karma points c-trib
    May 13, 2019 @ 08:20
    Christian A
    0

    Map loads slow when not in visible area

    Hello Jonathan

    We have an issue when we insert a map into a non-visible area (ie. below the manifold) the map loads slow (it seems like it does not start to load the map until the map is scrolled into a visible area). If you look closely you can actually see the map below a white slighty visible layer, but it takes up to 5 seconds for it to become visible after scrolling it into the visible area.

    If we insert the map at the top it is loaded almost instantly. Is there any logic that delays the load until the map becomes visible and if so, is there any way to disable it?

  • Jonathan Richards 288 posts 1742 karma points MVP
    May 13, 2019 @ 08:52
    Jonathan Richards
    0

    Hi Christain,

    Yes this is deliberate.

    Only maps that can be viewed by the user are rendered, this is so that many, even thousands of maps can be present on the page (Maybe they are available via a tab or drop down list selector) and only those that require resources then take resources. This also allows the page load time to be as fast as possible for the current view port. These are all positive things.

    If, for some reason, you don't want this, there is a flag you can set to disable active monitoring, though it will also stop the map responding to other events like the browser being resized.

       @Html.Terratype(new Options { DomMonitorType = DomMonitorTypes.Disable }, Map)
    

    Cheers

    Jonathan

  • Christian A 24 posts 98 karma points c-trib
    May 13, 2019 @ 10:11
    Christian A
    0

    Hello Jonathan,

    It makes sense, it's just a problem when it sometimes takes up to 5 seconds for the map to actually be rendered when its "viewport" becomes visible.

    I already stumbled upon the option to disable DomMonitor, but was not too happy about breaking events that handled resizing etc.

  • Christian A 24 posts 98 karma points c-trib
    May 14, 2019 @ 08:16
    Christian A
    0

    Hello Jonathan

    Is visibility detected at scroll or at a given time interval? Because sometimes the maps loads fast when you scroll to the map and sometimes it takes like 5 seconds. In other words it seems like sometimes you are lucky and it is detected right away and sometimes it takes longer to detect that the map frame has become visible.

    Also we are inserting maps using the Grid Editor component, is it possible to disable active monitoring for those maps?

  • Advance Ngwarati 25 posts 127 karma points
    Aug 23, 2019 @ 09:37
    Advance Ngwarati
    0

    Hi Chris,

    I'm facing the same issue, did you managed to find the solution?

    At Jonathan, is there any work around that i can do to make this better? Or if it possible to put something like a loader within that 5 seconds before it is visible rather than showing the while blank screen?

    Thanks in advance

    Regards,

    Advance

  • Jonathan Richards 288 posts 1742 karma points MVP
    Aug 23, 2019 @ 09:51
    Jonathan Richards
    1

    Hi Advance,

    https://github.com/Joniff/Terratype/blob/master/src/Core/Terratype/App_Plugins/Terratype/Scripts/terratype.renderer.js#L4

    Currently the poll speed is 100 milliseconds, this is how often it tries to detect changes to a particular map. If there are two maps present (they don't need to be on display) then only one map is checked each poll. If there are 50 maps present then there could be a delay of 5 seconds (100 milliseconds x 50 = 5 seconds) before a particular map is updated. This is intentional, as more processing will overload the browser.

    Feel free to find the file on your installation, change the value and compile a new minified version.

    Just note this 100 milliseconds was chosen for those with out-of-date browsers running on slow mobile devices.

    Cheers

    Jonathan Richards

  • Advance Ngwarati 25 posts 127 karma points
    Aug 23, 2019 @ 09:57
    Advance Ngwarati
    0

    Thanks Jonathan,

    Sorry for being dump, how can i compile to a new minified version. I managed to change the poll, but it is not working.

    Cheers,

  • Jonathan Richards 288 posts 1742 karma points MVP
    Aug 23, 2019 @ 10:04
    Jonathan Richards
    0

    Hi Advnace

    https://javascript-minifier.com/

    Cheers

    Jonathan Richards

  • Advance Ngwarati 25 posts 127 karma points
    Aug 23, 2019 @ 10:24
    Advance Ngwarati
    0

    Hi Jonathan,

    I changed the _poll and replace the renderer.min.js with the new compiled minified, but i'm now getting this error

    "Could not load file or assembly 'System.Reactive.Linq' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)"

    What did i do wrong?

  • Jonathan Richards 288 posts 1742 karma points MVP
    Aug 23, 2019 @ 10:30
    Jonathan Richards
    0

    Hi Advance,

    Never heard of System.Reactive.Linq, a quick google search says it this

    https://github.com/dotnet/reactive

    This has nothing to do with Umbraco or Terratype.

    I might guess you haven't minified the file correctly, but otherwise you are own as you have something very non-standard going on with your setup.

    Cheers

    Jonathan Richards

  • Advance Ngwarati 25 posts 127 karma points
    Aug 26, 2019 @ 08:47
    Advance Ngwarati
    0

    Hi Jonathan,

    Thanks for the help, it is now much better.

    Regards,

    Advance

  • Jay 425 posts 652 karma points
    Nov 16, 2021 @ 12:39
    Jay
    0

    Hi Jonathan,

    I've inherited an old site, been having the same issue.

    ive' tried to use the below

       @Html.Terratype(new Options { DomMonitorType = DomMonitorTypes.Disable }, Map)
    

    But it slow things even further.

    I've noticed that the map marker seems to load right away, but the map itself seems to only draw once you're on the visible area which takes 5s.

    Any other way to just want it to load right away?

    ive even tried to amend the poll settings to 10ms in the below file too /app_plugins/terratype/scripts/terratype.renderer.js file

Please Sign in or register to post replies

Write your reply to:

Draft