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
Backgroundlayerselector opacityslider #3553
Conversation
60a5bc2
to
94d69f5
Compare
94d69f5
to
3ac6b09
Compare
What's this strange pull request for? |
@sbrunner EPFL and Schwytz want back the opacity slider for a background layer as it was available in CGXP. Ngeo implementation is extending the current background selector. |
@@ -166,9 +175,34 @@ gmf.BackgroundlayerselectorController.prototype.$onInit = function() { | |||
gmf.BackgroundlayerselectorController.prototype.handleThemesChange_ = function() { | |||
this.gmfThemes_.getBgLayers().then((layers) => { | |||
this.bgLayers = layers; | |||
|
|||
if (this.opacityOptions !== undefined && !this.isThemeLoadedOnce_) { | |||
this.isThemeLoadedOnce_ = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment to explain that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
We shouldn't do that in 2.2... |
- New background group - General PR cleanup - Adapt getter for the backgroundlayermanager
c687e1b
to
4fe22dd
Compare
6f17671
to
74c1862
Compare
|
||
/** | ||
* @type {?ol.Map} | ||
* @type {?string} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be {!string|undefined}
instead.
src/services/backgroundlayermgr.js
Outdated
layer.setOpacity(0); | ||
layer.setVisible(true); | ||
const bgGroup = this.ngeoLayerHelper_.getGroupFromMap(map, gmf.BACKGROUNDLAYERGROUP_NAME); | ||
bgGroup.getLayers().insertAt(1, layer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove all the extra layers (> 1) using a for (i=1; i< bgGroup.getLayers().length) and bgGroup.getLayers().removeAt(i).
Then the method will be callable several times.
@@ -166,9 +175,37 @@ gmf.BackgroundlayerselectorController.prototype.$onInit = function() { | |||
gmf.BackgroundlayerselectorController.prototype.handleThemesChange_ = function() { | |||
this.gmfThemes_.getBgLayers().then((layers) => { | |||
this.bgLayers = layers; | |||
|
|||
if (this.opacityOptions !== undefined && !this.isThemeLoadedOnce_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is called several times, it should be normal.
I would avoid messing with the ordering inside getBgLayers
so I suggest to duplicate the array before changing it (use slice without arguments).
Then remove the isThemeLoadedOnce
condition.
@ybolognini, we are going to migrate EPFL to 2.3 starting this week. Can we instead merge it in 2.3? |
@gberaudo it is promised to Schwyz for an upcoming 2.2 version, too. |
@llienher, there is a test failing:
|
Add a way to get a static background layer linked to an opacity slider, via a parameter to include in the interface. I.E:
The string is the layer label (column name from admin interface when defining the layers).
The component is defined as follow in the html:
gmf-backgroundlayer-opacity-options
is facultative and if ignored, the application will just set as it was without the feature.First commit is remove correctly the dimension used in the past but not done completly.
The app now use a group containing the active layer and the one used as overlay for the opacity slider. This group is called "background" and is always index 0 with group "data" at index 1.
Tests are updated to this new structures.