diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-09-03 15:48:21 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-09-04 17:51:45 +0100 |
commit | 1d78ea3872d48c9184e9b1df183c5d5a0c1d605f (patch) | |
tree | a2677c86d966848bc40f58e92012920b6d3dc2d8 | |
parent | e90cf8b57f598cf5f7137c3fbd6e73d08560822f (diff) |
Always perform layer loadend one-off setup.
This was previously restricted to coming directly to /report/new, but
this meant it wasn't being run when e.g. Buckinghamshire winter routes
or Westminster TfL roads were being loaded after the appropriate
category selection, so their effects did not occur (as the checkFeature
code was called prior to the layer finishing loading).
-rw-r--r-- | web/cobrands/fixmystreet/assets.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js index 466ca3b40..1de595c53 100644 --- a/web/cobrands/fixmystreet/assets.js +++ b/web/cobrands/fixmystreet/assets.js @@ -275,8 +275,9 @@ function init_asset_layer(layer, pins_layer) { layer.fixmystreet.fault_layer.setZIndex(layer.getZIndex()-1); } - if (fixmystreet.page == 'new' && (layer.fixmystreet.usrn || layer.fixmystreet.road)) { - // If the user visits /report/new directly and doesn't change the pin + if (layer.fixmystreet.usrn || layer.fixmystreet.road) { + // If an asset layer only loads once a category is selected, or if the + // user visits /report/new directly and doesn't change the pin // location, then the assets:selected/maps:update_pin events are never // fired and USRN's checkFeature is never called. This results in a // report whose location was never looked up against the USRN layer, |