-
Notifications
You must be signed in to change notification settings - Fork 86
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
Fix print layers when opacity background layer is a layer group #4041
Conversation
* @return {Array.<ol.layer.Layer>} Layers. | ||
* @private | ||
*/ | ||
exports.prototype.getFlatLayers_ = function(layer, array) { | ||
if (layer instanceof olLayerGroup) { | ||
exports.prototype.getFlatLayers_ = function(layer, array, computedOpacity) { |
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.
Can you use an optional arguments for "computedOpacity" instead of calling this function with "undefined" at line 297 ?
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.
After discussion with @gberaudo, we prefer that it is explicit that the value is called as 'undefined' instead of skipping the last argument.
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.
Okay
}); | ||
} else { | ||
if (array.indexOf(layer) < 0) { | ||
layer.set('inheritedOpacity', computedOpacity, 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.
Can you check in our code if there is a way to indicate (document) that this opacity and should be used ?
44f7dc1
to
33bbc8c
Compare
src/print/Service.js
Outdated
* Return an opacity value for the specified layer. | ||
* Usage: When we flatten a group (getFlatLayers() method), we get only the child layers. | ||
* If opacity is defined on the group, this value is lost. | ||
* Inherited opacity is a custom 'back-up' value that contains the parent element opacity. |
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.
The value does not just come from the parent but is computed based on the layer opacity and the one of all its ancestors.
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 documentation should be attached to the getFlatLayers_
method.
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.
See my comments, otherwise LGTM.
src/print/Service.js
Outdated
* Return an opacity value for the specified layer. | ||
* Usage: When we flatten a group (getFlatLayers() method), we get only the child layers. | ||
* If opacity is defined on the group, this value is lost. | ||
* Inherited opacity is a custom 'back-up' value that contains the parent element opacity. |
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 documentation should be attached to the getFlatLayers_
method.
33bbc8c
to
90c73e9
Compare
Fixes an print issue with opacity background layer when this is a group of layer instead of a single layer element.
When we generate the print layers, we flatten the gmf layers to remote the group, but we did loose the opacity in the process when this value was only on the group. This PR fixes and apply back the opacity to the layer once flatten.