Set pointer-event: none for ScaleLine

There is no reason to interact with this control and for the
`bar` option the blocked rect may be unexpectedly large
This commit is contained in:
Maximilian Krög
2022-08-06 23:00:33 +02:00
parent ff79897f06
commit 564d9d7685

View File

@@ -80,15 +80,11 @@ class ScaleLine extends Control {
constructor(opt_options) {
const options = opt_options ? opt_options : {};
const className =
options.className !== undefined
? options.className
: options.bar
? 'ol-scale-bar'
: 'ol-scale-line';
const element = document.createElement('div');
element.style.pointerEvents = 'none';
super({
element: document.createElement('div'),
element: element,
render: options.render,
target: options.target,
});
@@ -108,6 +104,13 @@ class ScaleLine extends Control {
*/
this.un;
const className =
options.className !== undefined
? options.className
: options.bar
? 'ol-scale-bar'
: 'ol-scale-line';
/**
* @private
* @type {HTMLElement}