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

Hiding zoom controls #59

Closed
trixon opened this issue Aug 19, 2019 · 3 comments

Comments

@trixon
Copy link

commented Aug 19, 2019

Is there a good and easy way to hide the zoom controls in the upper left corner of the map?
I'm able to do it by replacing

controls: ol.control.defaults({
    zoom: interactive
}),

with
controls: [],
in mapview.js.

However, placing this altered mapview.js in my project does not override it, this could be due to NetBeans class loaders, I don't know.

The reason for wanting this is that I already have a zoom control, the one in the lower left corner of:
alt tag

@sothawo

This comment has been minimized.

Copy link
Owner

commented Aug 19, 2019

Hi Patrick,
using your own mapview.js will not work, as this is loaded from the same path where the html is loaded from; and placing that in a custom folder where it is found by the classloader first would mean that you need to put all the html and js files there - including OpenLayers. I would not guarantee that this is working.

My idea would be to change the initialization of the MapView Java object (and of the underlaying Javaascript object). At the moment there are the two parameters for the projection and the interactive flag; This is messy and I would like to encapsulate this into a separate configuration object which is then internally transferred into an configuration object for the Javascript class. This would leave room for extending and adding configuration options.

I'll put this on my list, but it might be the next weekend before I find time to implement this.

btw, although I know that some people are using mapjfx, this is the first screenshot I see of an application that integrates it, looks nice

@sothawo sothawo added the enhancement label Aug 19, 2019

@sothawo sothawo added this to To do in mapjfx Aug 19, 2019

@sothawo sothawo moved this from To do to In progress in mapjfx Aug 21, 2019

@sothawo sothawo moved this from In progress to To do in mapjfx Aug 21, 2019

@sothawo sothawo moved this from To do to In progress in mapjfx Aug 22, 2019

@sothawo sothawo self-assigned this Aug 22, 2019

@sothawo

This comment has been minimized.

Copy link
Owner

commented Aug 22, 2019

implemented in versions 1.27.0 and 2.8.0

tl;dr
configure your MapView instance with:

        mapView.initialize(Configuration.builder()
            .showZoomControls(false)
            .build());

@sothawo sothawo closed this Aug 22, 2019

mapjfx automation moved this from In progress to Done Aug 22, 2019

@trixon

This comment has been minimized.

Copy link
Author

commented Aug 22, 2019

Works great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants
You can’t perform that action at this time.