Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular 15 import #181

Open
Edo2610 opened this issue Aug 8, 2023 · 7 comments
Open

Angular 15 import #181

Edo2610 opened this issue Aug 8, 2023 · 7 comments

Comments

@Edo2610
Copy link

Edo2610 commented Aug 8, 2023

I have to use Annotorious on angular 15 using these versions:

"openseadragon": "^4.1.0",
"@recogito/annotorious-openseadragon": "^2.7.10"

and when I develop I not have any problem with Annotorious plugin, it works perfectly!
When I build my angular app and I deploy it, I get this error when I use Annotorious constructor

image

that correspond at this line of code this.annotorious = Annotorious(this.viewer, this.annoOptions);

Does anyone have a solution?

N.B. I try to import in two way and I still always have the same problem:

  • import * as Annotorious from '@recogito/annotorious-openseadragon';
  • import * as Annotorious from 'assets/script/openseadragon/openseadragon-annotorious';
@Edo2610
Copy link
Author

Edo2610 commented Aug 21, 2023

[RESOLVED]

Seraching on the source code I suppose that something is wrong in the way that I use to import the library.
Following the official Getting Started guide

image

I get the error.
Importing the library in this way import OSDAnnotorious from '@recogito/annotorious-openseadragon'; and using the constructor OSDAnnotorious instead of Annotorious all works well also during deploy and in prod mode!!

@Edo2610 Edo2610 closed this as completed Aug 21, 2023
@Edo2610
Copy link
Author

Edo2610 commented Aug 21, 2023

@rsimon pheraphs the Getting Started guide can be fixed and also an option that creates a definitions file (.d.ts) can be added during build to not incur in this errors!

@Edo2610 Edo2610 reopened this Aug 21, 2023
@lumalav
Copy link

lumalav commented Aug 23, 2023

[RESOLVED]

Seraching on the source code I suppose that something is wrong in the way that I use to import the library. Following the official Getting Started guide

image

I get the error. Importing the library in this way import OSDAnnotorious from '@recogito/annotorious-openseadragon';` all works well also during deploy and in prod mode!!

Hey! I am trying your solution and its not working for me... its throwing a annotorious_openseadragon_1.default is not a constructor

Is there a way that you could help me here in this stackblitz?

Thanks!

@Edo2610
Copy link
Author

Edo2610 commented Aug 24, 2023

The problem is that you are using annotorious plugin for osd but the img is not loaded with osd.
Anyway not only the import is OSDAnnotorious but also the contructor. I edited my solution upper!

Check this example

@lumalav
Copy link

lumalav commented Aug 24, 2023

@Edo2610 Awesome! thanks so much man.

@niyato
Copy link

niyato commented Aug 30, 2023

It's okay to hold down the mouse and drag to draw a rectangle, but what happens when you can't draw a label after just one click

@rsimon
Copy link
Member

rsimon commented Oct 1, 2023

Concerning Angular integration: I'm reposting from a similar issue here:

If anyone is still listening on this issue: the next major release of Annotorious is getting closer to release-ready. It's a complete re-write, and I believe that it will make integration with different frameworks much easier.

As of now, v3 has practically no documentation, and it doesn't have feature parity with v2.7. (Most importantly, it's headless mode only for now.) But if anyone wants to look: I believe it will solve a lot of the tedious interoperability issues that you are facing.

As written above, I'm not an Angular person. Which means I can still not give any advice. But if you look at how integration is done for React and Svelte, you might find some inspiration on how to do it for Angular.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants