How to use the openseadragon 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.

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

github ProjectMirador / mirador / src / components / OpenSeadragonViewer.js View on Github external
componentDidMount() {
    const { osdConfig, viewer } = this.props;
    if (!this.ref.current) {
      return;
    }

    this.viewer = new OpenSeadragon({
      id: this.ref.current.id,
      ...osdConfig,
    });

    this.osdCanvasOverlay = new OpenSeadragonCanvasOverlay(this.viewer);
    this.viewer.addHandler('update-viewport', this.onUpdateViewport);
    // Set a flag when OSD starts animating (so that viewer updates are not used)
    this.viewer.addHandler('animation-start', () => {
      this.osdUpdating = true;
    });
    this.viewer.addHandler('animation-finish', this.onViewportChange);
    this.viewer.addHandler('animation-finish', () => {
      this.osdUpdating = false;
    });

    this.updateCanvas = this.canvasUpdateCallback();
github NaturalHistoryMuseum / ckanext-nhm / ckanext / nhm / theme / fanstatic / scripts / apps / vfactor-iiif / src / components / OpenSeadragonView.vue View on Github external
mounted() {
            this.viewer = OpenSeadragon({
                id: "osd_viewer",
                // need to change this to use the images in the node module
                prefixUrl: "https://cdn.jsdelivr.net/npm/openseadragon@2.4/build/openseadragon/images/",
                sequenceMode: false,
                tileSources: []
            });
        }
    }
github UMNLibraries / react-openseadragon / src / react-openseadragon-viewer.js View on Github external
componentDidMount() {
    this.setStrings();

    if (typeof window.OpenSeadragon !== 'undefined') {
      OPENSEADRAGONVIEWER = window.OpenSeadragon(this._config());
    } else {
      OPENSEADRAGONVIEWER = OpenSeadragon(this._config());
    }
    // Start at the image specified in the URL
    OPENSEADRAGONVIEWER.goToPage(this.props.currentPageId);
  }
github btzr-io / Villain / packages / villain-react / src / components / render.js View on Github external
initOpenSeaDragon = () => {
    const { id, container, pages, renderError, updateContextState } = this.props

    // Detect browser vendor
    this.browser = getKeyByValue(OpenSeaDragon.BROWSERS, OpenSeaDragon.Browser.vendor)

    // Create viewer
    this.viewer = OpenSeaDragon({
      element: this.OSDContainer.current,
      tileSources: pages[0],
      ...OSDConfig,
    })

    // Events handler
    this.viewer.addHandler('open', () => {
      this.renderLayout()
      this.fitBounds()

      // Prevent unessesart context updates
      if (renderError) {
        updateContextState({ renderError: false })
      }
    })
github digirati-co-uk / canvas-panel / src / viewers / OpenSeadragonViewer / OpenSeadragonViewer.js View on Github external
componentDidMount() {
    const {getRef, onImageLoaded, tileSource} = this.props;
    if (!tileSource) {
      console.error('Something went wrong, we cannot display the open sea dragon');
      this.setState({ fallback: true });
      return;
    }
    this.setState({ fallback: false });
    this.viewer = new OpenSeadragon({
      element: this.element,
      ajaxWithCredentials: false,
      showNavigator: true,
      showRotationControl: true,
      defaultZoomLevel: 0,
      maxZoomPixelRatio: 1,
      navigatorPosition: 'BOTTOM_RIGHT',
      animationTime: 0.3,
      immediateRender: true,
      preserveViewport: true,
      blendTime: 0.1,
      minPixelRatio: 0.5,
      visibilityRatio: 0.65,
      constrainDuringPan: false,
      showSequenceControl: false,
      showNavigationControl: false,
github digirati-co-uk / canvas-panel / packages / canvas-panel-core / src / viewers / OpenSeadragonViewer / OpenSeadragonViewer.js View on Github external
componentDidMount() {
    const { getRef, onImageLoaded, tileSources, osdOptions } = this.props;
    if (!tileSources) {
      console.error(
        'Something went wrong, we cannot display the open sea dragon'
      );
      this.setState({ fallback: true });
      return;
    }
    this.setState({ fallback: false });
    this.viewer = new OpenSeadragon({
      element: this.element,
      ajaxWithCredentials: false,
      showNavigator: true,
      showRotationControl: true,
      defaultZoomLevel: 0,
      maxZoomPixelRatio: 1,
      navigatorPosition: 'BOTTOM_RIGHT',
      animationTime: 0.3,
      immediateRender: true,
      preserveViewport: true,
      blendTime: 0.1,
      minPixelRatio: 0.5,
      visibilityRatio: 0.65,
      minZoomImageRatio: 1,
      constrainDuringPan: false,
      showSequenceControl: false,
github wellcometrust / wellcomecollection.org / common / views / components / ZoomedImage / ZoomedImage.js View on Github external
.then(response => {
        const osdViewer = openseadragon({
          id: `image-viewer-${viewerId}`,
          showNavigationControl: false,
          visibilityRatio: 1,
          tileSources: [
            {
              '@context': 'http://iiif.io/api/image/2/context.json',
              '@id': response['@id'],
              height: response.height,
              width: response.width,
              profile: ['http://iiif.io/api/image/2/level2.json'],
              protocol: 'http://iiif.io/api/image',
              tiles: [
                {
                  scaleFactors: [1, 2, 4, 8, 16, 32],
                  width: 400,
                },
github NCI-GDC / portal-ui / src / packages / @ncigdc / components / ZoomableImage.js View on Github external
.then(data => {
          const { imageId, setViewer, setImageParams } = this.props;
          if (!data.Format) {
            this.props.setLoadError(true);
          } else {
            this.props.setLoadError(false);
            setImageParams({
              height: Number(data.Height),
              width: Number(data.Width),
              overlap: Number(data.Overlap),
              tileSize: Number(data.TileSize),
            });
            const viewer = OpenSeadragon({
              id: 'osd1',
              prefixUrl:
                'https://cdn.jsdelivr.net/npm/openseadragon@2.3/build/openseadragon/images/',
              visibilityRatio: 1,
              minLevel: 0,
              maxLevel: 14,
              showNavigator: true,
              tileSources: {
                height: Number(data.Height),
                width: Number(data.Width),
                tileSize: Number(data.TileSize),
                overlap: Number(data.Overlap),
                getTileUrl: (level, x, y) => {
                  return `${SLIDE_IMAGE_ENDPOINT}${imageId}?level=${level}&x=${x}&y=${y}`;
                },
              },

openseadragon

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

BSD-3-Clause
Latest version published 25 days ago

Package Health Score

89 / 100
Full package analysis