How to use the d3-zoom/src/transform.Transform.prototype function in d3-zoom

To help you get started, we’ve selected a few d3-zoom 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 shinima / trips-editor / src / preloaded.ts View on Github external
* else the result stream will emit `mapFn(t)`.
     */
    checkedFlatMap<u>(checkFn: (t: T) =&gt; boolean, mapFn: (t: T) =&gt; Stream<u>): Stream<u>
    checkedFlatMap<u>(/* checkFn = Boolean */ mapFn: (t: T) =&gt; Stream<u>): Stream<u>
  }
}

declare module 'd3-zoom' {
  interface ZoomTransform {
    invertPos(p: Point): Point
    applyPos(p: Point): Point
  }
}

const { Transform } = require('d3-zoom/src/transform')
Transform.prototype.invertPos = function invertPos(p: Point): Point {
  const [x, y] = this.invert([p.x, p.y])
  return { x, y }
}
Transform.prototype.applyPos = function applyPos(p: Point): Point {
  const [x, y] = this.apply([p.x, p.y])
  return { x, y }
}
</u></u></u></u></u></u>
github shinima / trips-editor / src / preloaded.ts View on Github external
}
}

declare module 'd3-zoom' {
  interface ZoomTransform {
    invertPos(p: Point): Point
    applyPos(p: Point): Point
  }
}

const { Transform } = require('d3-zoom/src/transform')
Transform.prototype.invertPos = function invertPos(p: Point): Point {
  const [x, y] = this.invert([p.x, p.y])
  return { x, y }
}
Transform.prototype.applyPos = function applyPos(p: Point): Point {
  const [x, y] = this.apply([p.x, p.y])
  return { x, y }
}

d3-zoom

Pan and zoom SVG, HTML or Canvas using mouse or touch input.

ISC
Latest version published 3 years ago

Package Health Score

77 / 100
Full package analysis