Coder Social home page Coder Social logo

mirador-imagecropper's Introduction

mirador-imagecropper

npm package required Mirador version

A Mirador 3 plugin to retrieve the image url for the selected area.

Screenshot1 Screenshot2

Installation

Currently the plugin can only be used if you build your own Mirador JavaScript bundle. To include the plugin in your Mirador installation, you need to install it from npm with npm install mirador-imagecropper, import it into your project and pass it to Mirador when you instantiate the viewer:

import Mirador from 'mirador/dist/es/src/index';
import imageCropperPlugin from 'mirador-imagecropper/es';

const miradorConfig = {
  // Your Mirador configuration
}
Mirador.viewer(config, [...imageCropperPlugin]);

Configuration

You can configure the plugin globally for all windows and/or individually for every window.

For global configuration add the imageCropper entry to the top-level window configuration (globally for all windows) or to the individual window object:

const miradorConfig = {
  window: {
    // ....
    imageCropper: {
      // Global config for all windows, see available settings below
    },
  },
  windows: [{
    // ....
    imageCropper: {
      // config for an individual window, see available settings below
    },
  }, // ...
}

You can view an example configuration in demo/src/index.js.

The available settings are:

  • active: If the cropping overlay is active. Boolean, defaults to false.
  • dialogOpen: If the settings dialog is open. Boolean, defaults to false.
  • enabled: If the plugin is enabled. Boolean, defaults to true.
  • roundingPrecision: Set the number of decimal places. Number, defaults to 5.
  • showRightsInformation: If rights information defined in the manifest should be shown. Boolean, defaults to true.

Contributing

Found a bug? The plugin is not working with your manifest? Want a new feature? Create an issue, or if you want to take a shot at fixing it yourself, make a fork, create a pull request, we're always open to contributions :-)

For larger changes/features, it's usually wise to open an issue before starting the work, so we can discuss if it's a fit.

Note: The package requires Node.js 16 and npm in major version 8.

mirador-imagecropper's People

Contributors

dependabot[bot] avatar jbaiter avatar mexthecat avatar morpheus-87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

skoegl mexthecat

mirador-imagecropper's Issues

Dialogs not visible in fullscreen mode

When the Mirador viewer goes into fullscreen mode, everything else that's not contained below the element with class="fullscreen" will be hidden.

Unfortunately, this means that the popup dialogs of the ImageCropper and CanvasLink plugins, and maybe others, won't be visible when Mirador has been launched fullscreen.

I'm not sure if the dialog can be appended inside the div (easiest solution), or that this should happen only if you're in fullscreen mode.

Some difficulties trying to operate the tool

Having had occasion to experiment a little with this tool, I'd like to come back with a little more feedback:

  • The way most users who are interested in certain details of a manuscript (letters, abbreviations, initials, passages of text, drawings, etc.) tend to work is that they zoom in first and when the item of interest is within view, activate the image cropper. However, what I often experienced at that zoom level is that the tool is then difficult or even impossible to use. It may cover the entire canvas or it becomes difficult to drag and resize. What I like about similar tools is that they allow you to zoom in and draw a shape, typically a rectangle, around any item of interest. Could that sort of functionality be implemented here?

  • In some cases the tool would not appear to become active after clicking the icon in the menu. However, when I flipped back and forth through the pages, it turned out that the cropper region had actually become active, just on the wrong page.

How to show a default crop with max-width:100%?

Many thanks for making this plugin available! If I understand correctly, it is the Mirador 3 successor to https://github.com/dbmdz/mirador-plugins/tree/main/ImageCropper (to judge by the installation instructions requiring webpack) and probably doesn't work with IIIF Presentation API lower than 3.0 (my test cases with 2.0 didn't work).

When I tried it out, I noticed that selected regions are based on percentages (per https://iiif.io/api/image/3.0/#41-region). That is wonderful because it is the only way to retrieve the region irrespective of image size. However, the image size is set at the maximum pct:100 by default and when I copy the URL and want to show an image with a max-width of 100%, the region becomes distorted and what remains gets a dark background, as demonstrated in this image:

Screenshot 2021-09-06 at 10 09 02

The image at the bottom is the actual region, with image size set to 500,. The one at the top shows what goes wrong when it is set to pct:100.

I've googled for solutions but couldn't find any (yet). Could anyone a recommend how to deal with this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.