How to use the @swim/structure.Record.of function in @swim/structure

To help you get started, we’ve selected a few @swim/structure 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 swimos / ripple / ui / main / MirrorView.ts View on Github external
protected onMouseDown(event: MouseEvent): void {
    if (event.button !== 0 || this._presses["mouse"]) {
      return;
    }

    document.body.addEventListener("mousemove", this.onMouseMove);
    document.body.addEventListener("mouseup", this.onMouseUp);

    const charge = this.createCharge(Record.of(this.id, "mouse"), Date.now(), event.clientX, event.clientY);
    this._presses["mouse"] = charge;
    this.appendChildView(charge);
    this.onPressDown(charge);
  }
github swimos / ripple / ui / main / MirrorView.ts View on Github external
if (this.captive) {
      event.preventDefault();
    }
    const touches = event.changedTouches;
    for (let i = 0, n = touches.length; i < n; i += 1) {
      const touch = touches[i];
      const pressId = "touch" + touch.identifier;
      let charge = this._presses[pressId];
      if (charge === void 0) {
        if (this._touchCount === 0) {
          const canvasView = this.canvasView;
          canvasView.on("touchmove", this.onTouchMove);
          canvasView.on("touchcancel", this.onTouchCancel);
          canvasView.on("touchend", this.onTouchEnd);
        }
        charge = this.createCharge(Record.of(this.id, pressId), Date.now(), touch.clientX, touch.clientY);
        this._presses[pressId] = charge;
        this._touchCount += 1;
        this.appendChildView(charge);
        this.onPressDown(charge);
      }
    }
  }