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
Feature: Drawing Annotations Undo Redo #287
Merged
Merged
Changes from 72 commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
12cc4ed
Fix: thread save incorrectly rejects when no dialogue exists
1872d82
Fix: error attempting to set dialogue threadnum when no dialogue exists
6db4184
Merge branch 'master' into branch/rebaseToRemote
Minh-Ng 48af9ac
Merge branch 'master' into branch/rebaseToRemote
Minh-Ng 533030c
Update: drawing annotations now rescale correctly
7f661ea
Fix: annotator is now loaded with the correct initial scale
7230510
Fix: update annotator tests for constructor change
b90659a
Update: drawingannotation rescaling
000b503
Merge branch 'master' into branch/rebaseToRemote
48b5589
Merge remote-tracking branch 'upstream/master' into feature/drawingAn…
8c88200
Update: tests for updating local annotations on annotationthreads
f3b557c
Merge branch 'branch/rebaseToRemote' of https://github.com/MinhHNguye…
ed403b8
Fix: typo
22d4faa
Update: merge initial scaling changes
4be971e
Merge branch 'branch/rebaseToRemote' into feature/drawingAnnotationSc…
51b0201
Update: fix tests
0757c0b
Fix: clean up anonymous functions
e4a097b
Fix: clean up anonymous functions
1075f78
Update: merge from master
f25c34c
Update: tests for docdrawingthread
70d619c
Update: change page change method
833a42a
Fix: various cleanup for PR
fe3587d
Fix: removing fixes coming in a different PR
924cd25
Fix: sentenced to 1 year of unit tests
3549473
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng 1857b90
Update: docdrawingthread documentation
cb87a9e
Merge branch 'feature/drawingAnnotationScaling' of https://github.com…
5402f45
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng 67e250f
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng bf29d9f
Update: merge from upstream master
7bd6fdb
Merge branch 'feature/drawingAnnotationScaling' of https://github.com…
74c85fc
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng 10d1616
Update: undo redo drawing container
18f0444
Merge branch 'master' into feature/drawingAnnotationScaling
pramodsum 60e259b
Update: resolve merge conflicts with master
034e37a
Fix: pull request feedback
8edb906
Update: remove todo
f79244b
New: drawing annotation undo and redo container
1fea19d
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng a1909fe
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng bb56ac4
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng d225a4a
Update: undo and redo grey out when applicable
6d0b4cc
Fix: update tests with new fn calls
b216523
Update: merge upstream master
bd25a6e
Chore: update variable name
08f44c1
Merge branch 'feature/drawingAnnotationScaling' of https://github.com…
41a5d51
Chore: actually update the draw states variable
5d05d52
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng 06e4f24
Merge branch 'master' into feature/undoredo
Minh-Ng abdc1ac
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng 55817f4
Update: drawing annotation svgs
1e31e26
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng c827c3e
Update: remove draw from drawstates
bf550bd
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng e44a151
Update: resolve conflicts from upstream
52642bf
Update: handle page change with two toggles
746d291
Update: merge from scaling pr
ee25fa4
Update: merge refactor from master
cffba79
Update: resolve merge
7f31e8c
Update: merge conflicts again please
0046949
Merge branch 'feature/drawingAnnotationScaling' into feature/undoredo
41287af
Fix: bind cleanup listeners on drawing thread and fix resize
1df105b
Fix: remove global test variable
94bf934
Merge branch 'feature/drawingAnnotationScaling' into feature/undoredo
2a39df7
Fix: scale annotations in redo stack
455549f
Update: drawing method cleanup
98d8e3b
Merge branch 'feature/undoredo' of https://github.com/MinhHNguyen/box…
fb0f5cb
Update: remove unused class
d8f9f80
Update: undo redo unit tests
6ac7878
Merge branch 'master' into feature/undoredo
Minh-Ng bad8368
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng 2509bd6
Merge remote-tracking branch 'upstream/master' into feature/undoredo
08c24bc
Merge branch 'feature/undoredo' of https://github.com/MinhHNguyen/box…
94e92c0
Merge branch 'master' into feature/drawingAnnotationScaling
Minh-Ng ab8358b
Update: remove isTypeEnabled
ae4e82c
Update: merge from master
73aaa87
Merge branch 'feature/drawingAnnotationScaling' into feature/undoredo
cdf8b6b
Update: fix tests again
15e0e72
Merge branch 'feature/drawingAnnotationScaling' into feature/undoredo
2612395
Merge branch 'master' into feature/undoredo
Minh-Ng 5bcc4a4
Update: resolve merge conflicts
d02ac11
Update: added test for DocDrawingThreadShow
c3d3ee5
Merge branch 'master' into feature/undoredo
Minh-Ng 82012d1
Update: PR changes
a8a9be5
Update: custom thread cleanup for drawing annotationevent
e6e77fd
Merge branch 'master' into feature/undoredo
Minh-Ng 53aed0e
Merge branch 'feature/undoredo' of https://github.com/MinhHNguyen/box…
91bffcc
Update: resolve merge conflict
fea659b
Merge branch 'master' into feature/undoredo
Minh-Ng 7ba6bc6
Merge branch 'master' into feature/undoredo
Minh-Ng d08bd4f
Update: fix test from merging master
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -285,6 +285,23 @@ describe('lib/annotations/Annotator', () => { | |
}); | ||
}); | ||
|
||
describe('isTypeEnabled()', () => { | ||
it('should return true when option.TYPE includes the type being checked', () => { | ||
annotator.options.TYPE = [TYPES.point, TYPES.draw]; | ||
expect(annotator.isTypeEnabled(TYPES.draw)).to.be.truthy; | ||
}); | ||
|
||
it('should return false when option.TYPE does not include the type being checked', () => { | ||
annotator.options.TYPE = [TYPES.point, TYPES.highlight]; | ||
expect(annotator.isTypeEnabled(TYPES.draw)).to.be.falsy; | ||
}); | ||
|
||
it('should return false when option.TYPE does not exist', () => { | ||
annotator.options.TYPE = undefined; | ||
expect(annotator.isTypeEnabled(TYPES.draw)).to.be.falsy; | ||
}); | ||
}); | ||
|
||
describe('toggleAnnotationHandler()', () => { | ||
beforeEach(() => { | ||
stubs.destroyStub = sandbox.stub(annotator, 'destroyPendingThreads'); | ||
|
@@ -308,7 +325,7 @@ describe('lib/annotations/Annotator', () => { | |
annotator.toggleAnnotationHandler(TYPES.highlight); | ||
expect(stubs.destroyStub).to.be.called; | ||
expect(stubs.exitAnnotationModes) | ||
}) | ||
}); | ||
|
||
it('should turn annotation mode on if it is off', () => { | ||
stubs.annotationMode.returns(false); | ||
|
@@ -471,16 +488,26 @@ describe('lib/annotations/Annotator', () => { | |
it('should unbind custom listeners from the thread', () => { | ||
stubs.threadMock.expects('removeAllListeners').withArgs('threaddeleted'); | ||
stubs.threadMock.expects('removeAllListeners').withArgs('threadcleanup'); | ||
stubs.threadMock.expects('removeAllListeners').withArgs('annotationevent'); | ||
annotator.unbindCustomListenersOnThread(stubs.thread); | ||
}); | ||
}); | ||
|
||
describe('bindModeListeners()', () => { | ||
let drawingThread; | ||
|
||
beforeEach(() => { | ||
annotator.annotatedElement = { | ||
addEventListener: sandbox.stub(), | ||
removeEventListener: sandbox.stub() | ||
}; | ||
|
||
drawingThread = { | ||
handleStart: () => {}, | ||
handleStop: () => {}, | ||
handleMove: () => {}, | ||
addListener: sandbox.stub() | ||
}; | ||
}); | ||
|
||
it('should get event handlers for point annotation mode', () => { | ||
|
@@ -496,42 +523,7 @@ describe('lib/annotations/Annotator', () => { | |
expect(annotator.annotationModeHandlers.length).equals(2); | ||
}); | ||
|
||
it('should bind draw mode handlers', () => { | ||
const drawingThread = { | ||
handleStart: () => {}, | ||
handleStop: () => {}, | ||
handleMove: () => {} | ||
}; | ||
sandbox.stub(annotator, 'createAnnotationThread').returns(drawingThread); | ||
|
||
const postButtonEl = { | ||
addEventListener: sandbox.stub(), | ||
removeEventListener: sandbox.stub() | ||
}; | ||
sandbox.stub(annotator.previewUI, 'getAnnotateButton').returns(null); | ||
const locationHandler = (() => {}); | ||
|
||
sandbox.stub(annotatorUtil, 'eventToLocationHandler').returns(locationHandler); | ||
|
||
annotator.bindModeListeners(TYPES.draw); | ||
|
||
expect(annotator.annotatedElement.addEventListener).to.be.calledWith( | ||
sinon.match.string, | ||
locationHandler | ||
).thrice; | ||
expect(postButtonEl.addEventListener).to.not.be.calledWith( | ||
'click', | ||
sinon.match.func | ||
); | ||
expect(annotator.annotationModeHandlers.length).equals(3); | ||
}); | ||
|
||
it('should bind draw mode click handlers if post button exists', () => { | ||
const drawingThread = { | ||
handleStart: () => {}, | ||
handleStop: () => {}, | ||
handleMove: () => {} | ||
}; | ||
sandbox.stub(annotator, 'createAnnotationThread').returns(drawingThread); | ||
|
||
const postButtonEl = { | ||
|
@@ -553,7 +545,7 @@ describe('lib/annotations/Annotator', () => { | |
'click', | ||
sinon.match.func | ||
); | ||
expect(annotator.annotationModeHandlers.length).equals(4); | ||
expect(annotator.annotationModeHandlers.length).equals(6); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add tests for when only some of the buttons exist i.e postButtonEl, undoButton...etc |
||
}); | ||
}); | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
move this into a separate method + tests
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.
I'm planning on doing this in a separate PR (the code is actually in the process of being written on a different branch). I don't think it makes sense to separate and test it at the moment when it will be moved and changed in a coming class change.