dogodigi / opendispatcher

First responder HTML5 nodejs client application
http://www.opendispatcher.org
GNU General Public License v3.0
2 stars 8 forks source link

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

Open matthijsln opened 9 years ago

matthijsln commented 9 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.

milovanderlinden commented 9 years ago

Needs a testcase.

matthijsln commented 9 years ago

add a console.log to the event handler and select a few features