opengeogroep / safetymapsDBK

Opendispatcher fork for Falck safetymaps
http://www.falck.nl/nl/avd/producten_diensten/software/safety-maps
GNU General Public License v3.0
0 stars 1 forks source link

.dbk-title onclick event handler stacks up when new feature selected #32

Open matthijsln opened 8 years ago

matthijsln commented 8 years ago

In public/js/dbkjs/protocol/jsonDBK.js, function process():

                $('.dbk-title')
                    .text(feature.data.formeleNaam + ' ' + feature.data.informeleNaam)
                    .css('visibility', 'visible')
                    .on('click', function() {
                        dbkjs.modules.feature.zoomToFeature(feature);
                    });

The click handler is added to the class, but all handlers before that for previous features will still be called. This leads to sluggishness when a lot of features are selected without a page reload.

Solution is to register the onclick handler at startup which zooms to the feature (not dbkjs.options.feature, this is the JSON object, zoomToFeature() needs the OpenLayers feature to zoom to pand geometry). So save the OpenLayers feature to zoom to in process() function.

Check if fixed in nodeless override