emigre / openseadragon-annotations

Draw annotations over deep zoom images
BSD 3-Clause "New" or "Revised" License
97 stars 40 forks source link

v1.0.5 not compiling #24

Open hugeps opened 5 years ago

hugeps commented 5 years ago

What could be possibly done to fix that ?

require('./bootstrap'); $.OpenSeadragon = require('openseadragon'); require('openseadragon-annotations');

                var viewer = OpenSeadragon({

/// followed by viewer.initializeAnnotations(); // const annotations = new OpenSeadragon.Annotations({viewer});

ERROR in ./node_modules/openseadragon-annotations/src/main.js Module not found: Error: Can't resolve 'OpenSeadragon' in '/home/vagrant/dview/portal/node_modules/openseadragon-annotations/src' @ ./node_modules/openseadragon-annotations/src/main.js 1:0-67 @ ./resources/js/document-edit.js @ multi ./resources/js/document-edit.js

ERROR in ./node_modules/openseadragon-annotations/src/controls/Control.js Module not found: Error: Can't resolve 'OpenSeadragon' in '/home/vagrant/dview/portal/node_modules/openseadragon-annotations/src/controls' @ ./node_modules/openseadragon-annotations/src/controls/Control.js 1:0-47 @ ./node_modules/openseadragon-annotations/src/controls/Move.js @ ./node_modules/openseadragon-annotations/src/controls/index.js @ ./node_modules/openseadragon-annotations/src/main.js @ ./resources/js/document-edit.js @ multi ./resources/js/document-edit.js

ERROR in ./node_modules/openseadragon-annotations/src/store/Store.js Module not found: Error: Can't resolve 'OpenSeadragon' in '/home/vagrant/dview/portal/node_modules/openseadragon-annotations/src/store' @ ./node_modules/openseadragon-annotations/src/store/Store.js 1:0-54 @ ./node_modules/openseadragon-annotations/src/main.js @ ./resources/js/document-edit.js @ multi ./resources/js/document-edit.js

ERROR in ./node_modules/openseadragon-annotations/src/components/Annotations.js Module parse failed: Unexpected token (98:8) You may need an appropriate loader to handle this file type. | 'svg', | { | ...svgProperties, | style: svgStyles, | onMouseDown: this.handleMouseDown.bind(this), @ ./node_modules/openseadragon-annotations/src/main.js 3:0-51 @ ./resources/js/document-edit.js @ multi ./resources/js/document-edit.js

rgdevx commented 4 years ago

I did this to make it work:

In node_modules/openseadragon-annotations/src/main.js Change: import OpenSeadragon, { Rect, ControlAnchor } from 'OpenSeadragon'; To: import OpenSeadragon, { Rect, ControlAnchor } from 'openseadragon';

In node_modules/openseadragon-annotations/src/controls/Control.js Change: import { extend, Button } from 'OpenSeadragon'; To: import { extend, Button } from 'openseadragon';

In node_modules/openseadragon-annotations/src/store/Store.js Change: import OpenSeadragon, { extend } from 'OpenSeadragon'; To: import OpenSeadragon, { extend } from 'openseadragon';

In node_modules/openseadragon-annotations/src/controls/Move.js Change:

import moveGroupHover from '../../img/move_grouphover.png';
import moveHover from '../../img/move_hover.png';
import movePressed from '../../img/move_pressed.png';
import moveRest from '../../img/move_rest.png';

To:

var moveGroupHover = '/img/move_grouphover.png';
var moveHover = '/img/move_hover.png';
var movePressed = '/img/move_pressed.png';
var moveRest = '/img/move_rest.png';

NOTE: you may need to update the path to these images in your user code, (the OpenSeadragon option prefixUrl can be used to set the button image path prefixes, and some plugins use this also), depending on your environment , and for the buttons in the main OpenSeadragon viewer also. A possible place for that is after creating the OpenSeadragon viewer object and initializing the OpenSeadragon-Annotations with viewer.initializeAnnotations (callback) , inside the callback method passed to this call. (This way of initializing can be used instead of the code they have in the documentation, which doesn't work: const annotations = new OpenSeadragon.Annotations({ viewer }); . More info available here ).

In node_modules/openseadragon-annotations/src/controls/Draw.js Change:

import drawGroupHover from '../../img/draw_grouphover.png';
import drawHover from '../../img/draw_hover.png';
import drawPressed from '../../img/draw_pressed.png';
import drawRest from '../../img/draw_rest.png';

To:

var drawGroupHover = '/img/draw_grouphover.png';
var drawHover = '/img/draw_hover.png';
var drawPressed = '/img/draw_pressed.png';
var drawRest = '/img/draw_rest.png';

NOTE: see note above

emigre commented 4 years ago

Hi @hugeps and @rgdevx . Sorry that I didn't get back to you earlier. I'm not sure about this anymore, I haven't had the time to invest in this at all to be honest. I do hope that the code as it is is still useful for you guys, feel free to make it your own and continue working on it. For me it's a burden and I'm planning on terminating it. I've thought about letting you know in case you need it.