default fill-opacity for polygons

'null' is not a sensible default
This commit is contained in:
Joachim Schleicher 2023-11-01 15:55:06 +01:00
parent af969eb5c0
commit 952385b1cd
3 changed files with 8 additions and 2 deletions

View file

@ -161,7 +161,7 @@ L.Util.detectFileType = (f) => {
}
L.Util.usableOption = (options, option) =>
options[option] !== undefined && options[option] !== ''
options[option] !== undefined && options[option] !== '' && options[option] !== null
L.Util.greedyTemplate = (str, data, ignore) => {
function getValue(data, path) {

View file

@ -828,7 +828,7 @@ L.U.PathMixin = {
highlightPath: function () {
this.parentClass.prototype.setStyle.call(this, {
fillOpacity: Math.sqrt(this.getDynamicOption('fillOpacity')),
fillOpacity: Math.sqrt(this.getDynamicOption('fillOpacity', 1.0)),
opacity: 1.0,
weight: 1.3 * this.getDynamicOption('weight'),
})

View file

@ -244,6 +244,12 @@ describe('L.U.FeatureMixin', function () {
var path = qs('path[stroke-opacity="1"]')
assert.ok(path)
})
it('should highlight polygon', function () {
var path = qs('path[fill="DarkBlue"]')
happen.click(path)
assert.isAbove(path.attributes['fill-opacity'].value, 0.5)
})
})
describe('#tooltip', function () {