@maplat/ui 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,11 @@
1
- import { Control, Rotate } from "ol5/control";
2
- import { CLASS_UNSELECTABLE, CLASS_CONTROL } from "ol5/css";
3
- import PointerEventHandler from "ol5/pointer/PointerEventHandler";
4
- import { listen } from "ol5/events";
5
- import EventType from "ol5/pointer/EventType";
6
- import { stopPropagation } from "ol5/events/Event";
7
- import ViewHint from "ol5/ViewHint";
8
- import { clamp } from "ol5/math";
9
- import { MapEvent } from "ol5";
1
+ import { Control, Rotate, Zoom as BaseZoom } from "ol/control";
2
+ import { CLASS_UNSELECTABLE, CLASS_CONTROL } from "ol/css";
3
+ import ViewHint from "ol/ViewHint";
4
+ import { clamp } from "ol/math";
5
+ import { MapEvent } from "ol";
10
6
  import { addResizeListener } from "../legacy/detect-element-resize";
11
7
  import pointer from "./pointer_images";
12
8
  import { createElement } from "@maplat/core";
13
- import { Zoom as BaseZoom } from "ol/control";
14
9
 
15
10
  let control_settings = {};
16
11
  const delegator = {
@@ -147,20 +142,25 @@ export class SliderCommon extends Control {
147
142
  * @type {ol.pointer.PointerEventHandler}
148
143
  * @private
149
144
  */
150
- this.dragger_ = new PointerEventHandler(containerElement);
151
-
152
- listen(
153
- this.dragger_,
154
- EventType.POINTERDOWN,
155
- this.handleDraggerStart_,
156
- this
157
- );
158
- listen(this.dragger_, EventType.POINTERMOVE, this.handleDraggerDrag_, this);
159
- listen(this.dragger_, EventType.POINTERUP, this.handleDraggerEnd_, this);
160
-
161
- listen(thumbElement, EventType.CLICK, stopPropagation);
162
-
163
- listen(this.element, EventType.MOUSEOUT, this.handleDraggerEnd_, this);
145
+ containerElement.addEventListener("pointerdown", ev => {
146
+ ev.stopPropagation();
147
+ this.handleDraggerStart_(ev);
148
+ });
149
+ containerElement.addEventListener("pointermove", ev => {
150
+ ev.stopPropagation();
151
+ this.handleDraggerDrag_(ev);
152
+ });
153
+ containerElement.addEventListener("pointerup", ev => {
154
+ ev.stopPropagation();
155
+ this.handleDraggerEnd_(ev);
156
+ });
157
+ thumbElement.addEventListener("click", ev => {
158
+ ev.stopPropagation();
159
+ });
160
+ containerElement.addEventListener("mouseout", ev => {
161
+ ev.stopPropagation();
162
+ this.handleDraggerEnd_(ev);
163
+ });
164
164
 
165
165
  if (control_settings["slider_color"]) {
166
166
  const rgb = hexRgb(control_settings["slider_color"]);
@@ -294,7 +294,7 @@ export class SliderCommon extends Control {
294
294
  handleDraggerStart_(event) {
295
295
  if (
296
296
  !this.dragging_ &&
297
- event.originalEvent.target === this.element.firstElementChild &&
297
+ event.target === this.element.firstElementChild &&
298
298
  !this.element.classList.contains("disable")
299
299
  ) {
300
300
  this.getMap().getView().setHint(ViewHint.INTERACTING, 1);