How to use the @deckdeckgo/utils.unifyEvent function in @deckdeckgo/utils

To help you get started, we’ve selected a few @deckdeckgo/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deckgo / deckdeckgo / remote / src / app / components / app-draw / app-draw.tsx View on Github external
private emit(type: DeckdeckgoEventType, e: any) {
        this.communicationService.emit({
            type: type,
            emitter: DeckdeckgoEventEmitter.APP,
            action: this.action,
            clientX: unifyEvent(e).clientX - this.widthOffset,
            clientY: unifyEvent(e).clientY - this.heightOffset,
            windowWidth: this.width,
            windowHeight: this.height,
            color: this.color
        });
    }
github deckgo / deckdeckgo / remote / src / app / components / app-draw / app-draw.tsx View on Github external
private startEvent = (e: MouseEvent) => {
        this.emit(DeckdeckgoEventType.START_DRAWING, e);

        this.startX = unifyEvent(e).clientX - this.deckLeftOffset - this.widthOffset;
        this.startY = unifyEvent(e).clientY - this.heightOffset;

        if (this.action === DeckdeckgoDrawAction.CIRCLE) {
            this.drawables.push(new Circle({x: this.startX, y: this.startY}, {
                x: this.startX,
                y: this.startY
            }, this.color))
        }

        this.drawEvents = true;
    };
github deckgo / deckdeckgo / remote / src / app / components / app-draw / app-draw.tsx View on Github external
private emit(type: DeckdeckgoEventType, e: any) {
        this.communicationService.emit({
            type: type,
            emitter: DeckdeckgoEventEmitter.APP,
            action: this.action,
            clientX: unifyEvent(e).clientX - this.widthOffset,
            clientY: unifyEvent(e).clientY - this.heightOffset,
            windowWidth: this.width,
            windowHeight: this.height,
            color: this.color
        });
    }
github deckgo / deckdeckgo / webcomponents / core / src / components / deck / deckdeckgo-deck / deckdeckgo-deck.tsx View on Github external
return new Promise((resolve) => {
      if (!this.startX) {
        resolve(null);
        return;
      }

      const slider: HTMLElement = this.el.shadowRoot.querySelector('div.deckgo-deck');

      if (!slider) {
        resolve(null);
        return;
      }

      const currentX: number = unifyEvent(e).clientX;

      if (this.startX === currentX) {
        resolve(null);
        return;
      }

      const swipeLeft: boolean = this.startX > currentX;

      resolve({
        slider: slider,
        swipeLeft: swipeLeft,
        deltaX: swipeLeft ? (this.startX - currentX) : (currentX - this.startX)
      })
    });
  }
github deckgo / deckdeckgo / remote / src / app / components / app-bottom-sheet / app-bottom-sheet.tsx View on Github external
private endEvent = ($event: MouseEvent) => {
        if (!this.startY || this.startY === undefined) {
            return;
        }

        $event.preventDefault();

        const toY: number = unifyEvent($event).clientY;

        if (this.startY > toY) {
            this.bottomSheetTop = this.bottomSheetTop <= this.bottomSheetMinHeight ? this.heightOffset : (this.bottomSheetTop + this.heightOffset >= this.content.offsetHeight ? this.content.offsetHeight : (this.bottomSheetTop + this.heightOffset));
        } else {
            this.bottomSheetTop = this.bottomSheetMinHeight;
        }

        this.startY = undefined;
    };
github deckgo / deckdeckgo / remote / src / app / components / app-bottom-sheet / app-bottom-sheet.tsx View on Github external
private startEvent = ($event: MouseEvent | TouchEvent) => {
        $event.preventDefault();

        this.startY = unifyEvent($event).clientY;
    };