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

feat(annotations): Add support for image annotations #1221

Merged
merged 2 commits into from
Jun 17, 2020

Conversation

jstoffan
Copy link
Collaborator

@jstoffan jstoffan commented Jun 6, 2020

Requires box/box-annotations#508 to function properly.

Todo

  • Unit tests

@jstoffan jstoffan requested a review from a team as a code owner June 6, 2020 00:43
@jstoffan jstoffan marked this pull request as draft June 6, 2020 00:44
Copy link
Contributor

@ConradJChan ConradJChan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jstoffan jstoffan force-pushed the add-image-support branch 2 times, most recently from 5217238 to 11e8caf Compare June 15, 2020 20:29
@jstoffan jstoffan marked this pull request as ready for review June 15, 2020 20:30
@jstoffan jstoffan force-pushed the add-image-support branch from 11e8caf to 286e4aa Compare June 15, 2020 20:56
@@ -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)) {
Copy link
Collaborator Author

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;
Copy link
Collaborator Author

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(),
Copy link
Contributor

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?

@mergify mergify bot merged commit 94d52f5 into box:master Jun 17, 2020
@jstoffan jstoffan deleted the add-image-support branch September 2, 2020 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants