How to use the openseadragon.Point function in openseadragon

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

github btzr-io / Villain / packages / villain-react / src / components / render.js View on Github external
renderLayout() {
    const { world } = this.viewer
    const { mangaMode, bookMode } = this.props
    const pos = new OpenSeaDragon.Point(0, 0)
    const count = world.getItemCount()

    // Cache tile data
    let bounds = null
    // first page
    let firstPage = null
    let firstPageIndex = bookMode && mangaMode && count > 1 ? 1 : 0
    let firstPageBounds = null
    // Next page
    let nextPage = null
    let nextPageBounds = null
    let nextPageIndex = bookMode && mangaMode ? 0 : 1

    if (count > 0) {
      // Page view (single page)
      firstPage = world.getItemAt(firstPageIndex)
github digirati-co-uk / canvas-panel / packages / canvas-panel-core / src / viewers / OpenSeadragonViewport / OpenSeadragonViewport.js View on Github external
resize(viewer) {
    const { canvas } = this.props;
    const firstImage = viewer.world.getItemAt(0);
    if (!firstImage) {
      return;
    }
    const imgWidth = canvas.getWidth();
    const imgHeight = canvas.getHeight();
    const imgAspectRatio = imgWidth / imgHeight;
    const boundsRect = viewer.viewport.getBounds(true);
    const viewportOrigin = new OpenSeadragon.Point(
      boundsRect.x,
      boundsRect.y * imgAspectRatio
    );

    const viewportWidth = boundsRect.width;
    const viewportHeight = boundsRect.height * imgAspectRatio;

    // Redraw
    const viewportZoom = viewer.viewport.getZoom(true);
    const zoom = firstImage.viewportToImageZoom(viewportZoom);
    const imageRatio =
      (firstImage._scaleSpring.current.value *
        firstImage.viewport._containerInnerSize.x) /
      firstImage.source.dimensions.x;

    const isZoomedOut =
github digirati-co-uk / canvas-panel / packages / canvas-panel-core / src / viewers / OpenSeadragonViewer / OpenSeadragonViewer.js View on Github external
createRelativePoint(x: number, y: number): ?OpenSeadragon.Point {
    if (!this.viewer) {
      return null;
    }

    return this.viewer.viewport.viewerElementToImageCoordinates(
      new OpenSeadragon.Point(x, y)
    );
  }
github digirati-co-uk / canvas-panel / packages / canvas-panel-core / src / viewers / OpenSeadragonViewer / OpenSeadragonViewer.js View on Github external
createViewportPoint(x: number, y: number) {
    if (!this.viewer) {
      return null;
    }
    return this.viewer.viewport.imageToViewerElementCoordinates(
      new OpenSeadragon.Point(x, y)
    );
  }
github digirati-co-uk / canvas-panel / src / viewers / OpenSeadragonViewer / OpenSeadragonViewer.js View on Github external
createRelativePoint(x, y) {
    return this.viewer.viewport.viewerElementToImageCoordinates(
      new OpenSeadragon.Point(x, y),
    );
  }
github digirati-co-uk / canvas-panel / src / viewers / OpenSeadragonViewer / OpenSeadragonViewer.js View on Github external
panTo(x, y) {
    this.viewer.viewport.panTo(new OpenSeadragon.Point(x, y));
  }
github digirati-co-uk / canvas-panel / src / viewers / OpenSeadragonViewer / OpenSeadragonViewer.js View on Github external
createViewportPoint(x, y) {
    return this.viewer.viewport.imageToViewerElementCoordinates(
      new OpenSeadragon.Point(x, y),
    );
  }
github digirati-co-uk / canvas-panel / packages / canvas-panel-core / src / viewers / OpenSeadragonViewer / OpenSeadragonViewer.js View on Github external
panTo(x: number, y: number, speed: number) {
    this.viewportAction('panTo', [new OpenSeadragon.Point(x, y)], speed);
  }

openseadragon

Provides a smooth, zoomable user interface for HTML/Javascript.

BSD-3-Clause
Latest version published 4 months ago

Package Health Score

85 / 100
Full package analysis