altert / OpenseadragonFabricjsOverlay

fabricjs canvas overlay for openseadragon
BSD 3-Clause "New" or "Revised" License
70 stars 64 forks source link

new version does not work #25

Open jetic83 opened 7 years ago

jetic83 commented 7 years ago

Using it as described in the readme ( viewer.fabricCanvas() ) throws an exception:

Unable to get property 'scale' of undefined or null reference

Is there a default for options.scale ?

altert commented 7 years ago

good catch, there is no default scale options, I'll add it. meanwhile you can initialize with e.g. viewer.fabricjsOverlay({scale: 1000});

jetic83 commented 7 years ago

Cool, thanks! It is also not clear to me what the scale means. Maybe a short description in the readme would be helpful.

altert commented 7 years ago

it's an arbitrary size for fabric canvas, similar (and corresponding to) OpenSeadragon viewport coordinates. For example, if you have one image loaded, by default viewport x coordinates of OpenSeadragon go from 0 to 1 (see Viewport Coordinates example) and if you have scale 1000 in this plugin, then fabric objects will have corresponding coordinates from 0 to 1000, so fabric x=1000 is right side of the image or Viewport coordinate x=1. If you need to have fabric coordinates tied to image pixel size, you can set scale to image width.