Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
matthijsln opened this issue Jan 15, 2015 · 2 comments
Open
Assignees
Labels
Milestone

Comments

@matthijsln
Copy link
Contributor

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
Copy link
Member

Needs a testcase.

@milovanderlinden milovanderlinden added this to the 3.1 milestone Jun 28, 2015
@milovanderlinden milovanderlinden self-assigned this Jun 28, 2015
@matthijsln
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants