-
Notifications
You must be signed in to change notification settings - Fork 116
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
feat(annotations): Add support for image annotations #1221
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
5217238
to
11e8caf
Compare
11e8caf
to
286e4aa
Compare
@@ -1090,7 +1112,7 @@ class BaseViewer extends EventEmitter { | |||
const { showAnnotationsControls, file } = this.options; | |||
const { permissions, extension } = file || {}; | |||
|
|||
if (!this.hasAnnotationPermissions(permissions)) { | |||
if (!this.hasAnnotationCreatePermission(permissions) && !this.hasAnnotationViewPermission(permissions)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes will ensure that the controls won't be shown until the backend enables support for the file type being previewed.
@@ -339,8 +344,8 @@ class ImageViewer extends ImageBaseViewer { | |||
this.imageEl.style.top = `${topPadding}px`; | |||
|
|||
// Fix the scroll position of the image to be centered | |||
this.wrapperEl.scrollLeft = (this.wrapperEl.scrollWidth - viewport.width) / 2; | |||
this.wrapperEl.scrollTop = (this.wrapperEl.scrollHeight - viewport.height) / 2; | |||
this.wrapperEl.scrollLeft = (this.imageEl.clientWidth - viewport.width) / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is more inside the wrapper now (annotations), so we need to look at the size of the actual image for our scroll reference.
removeAllListeners: sandbox.mock(), | ||
destroy: sandbox.mock(), | ||
removeAllListeners: sandbox.stub(), | ||
destroy: sandbox.stub(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use stub
here but use mock
in the above test?
Requires box/box-annotations#508 to function properly.
Todo