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

AnnotationLayer: scale undefined in this.context #173

Closed
renrizzolo opened this issue Mar 22, 2018 · 3 comments
Closed

AnnotationLayer: scale undefined in this.context #173

renrizzolo opened this issue Mar 22, 2018 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@renrizzolo
Copy link

Hi, this is apparent in v3.x

In AnnotationLayer.jsx, this.context.scale is undefined

  get viewport() {
    const { page, rotate, scale } = this.context;
    console.log(this.context.scale) // undefined
    return page.getViewport(scale, rotate);
  }

So when the scale changes, the annotations do not resize with the pdf.

Ahh, I just realized scale is not defined as a contextType in AnnotationLayer.jsx

AnnotationLayer.contextTypes = {
  linkService: isLinkService,
  onGetAnnotationsError: PropTypes.func,
  onGetAnnotationsSuccess: PropTypes.func,
  page: isPage,
  rotate: isRotate,
};

^ needs scale: PropTypes.number

@wojtekmaj this one line is not worth me doing a PR (I can't get the lib to build because of some babel issue anyway).

@wojtekmaj wojtekmaj self-assigned this Mar 22, 2018
@wojtekmaj wojtekmaj added the bug Something isn't working label Mar 22, 2018
@wojtekmaj wojtekmaj added this to the 3.0.0 milestone Mar 22, 2018
@wojtekmaj
Copy link
Owner

Thank you for pointing that out! I'll fix this asap.

@wojtekmaj
Copy link
Owner

Hi, I just release version 3.0.2. The error should now been fixed :) Additional measures to prevent that from happening in the future were also taken. Let me know if everything works for you!

@renrizzolo
Copy link
Author

@wojtekmaj thanks! All working now :)

alexandernanberg pushed a commit to alexandernanberg/react-pdf that referenced this issue Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants