inasafe/inasafe-django

Zooming behaviour to latest event

Closed this issue · 6 comments

Keep map zoom to latest event, but don't scroll to panel

check on Firefox, Chrome and Safari

now not zooming to panel (OK) but not zooming to latest event either (default zoom to world)

I check this myself, the map will zoom to world while the table is loading. But when it is loaded, the map zoom to latest event. Earthquake and Flood works the same way.

Sample gif (on realtime.inasafe.org):

zoom to event

Maybe I misunderstood the comment, but if that's not the case, we can close this @gubuntu .

@gubuntu I investigated this issue, these're the summary:

Problem:

  • The error raised by dynatable library plugin. It was trying to execute native js function of window.history.pushState
  • Firefox internal js function window.history.pushState raised the error (native error)
[Exception... "Illegal value"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: debugger eval code :: <TOP_LEVEL> :: line 1"  data: no

From the logname, I suspect this came from javascript binding for mac (from NS_ prefix). Can't debug inside.

Conclusion

I suspect the realtime code itself have no problem.
It is possible that the html5 spec of the dynatable code is outdated (last version on January 2014). However we can't upgrade this library. The maintainer doesn't update anymore. The code might not be buggy, but it depends on the html5 implementation of each browser.
Last conclusion, Firefox is being strict with the implementation, as you can see here:

The state object can be anything that can be serialized. Because Firefox saves state objects to the user's disk so they can be restored after the user restarts the browser, we impose a size limit of 640k characters on the serialized representation of a state object. If you pass a state object whose serialized representation is larger than this to pushState(), the method will throw an exception. If you need more space than this, you're encouraged to use sessionStorage and/or localStorage.

-- https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method

So, what really happens is the list of shake is too big for dynatable to store it on HTML5 storage using javascript serialization.

Solution

There are alternatives:

  1. Leave it be. We can't update the library anymore and it works on other browser.
  2. Change to another table library. But potentially affect all the client side filtering and table presentation.

it would be good to be standards compliant and work on all modern standards compliant browsers. But I guess its not high priority. We could address it when we merge into GeoNode

I figured it out how to fix this in issue #200