-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Submitty/eraser
Eraser
- Loading branch information
Showing
9 changed files
with
773 additions
and
722 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ node_modules/ | |
coverage/ | ||
sandbox/shared | ||
web/shared | ||
dist | ||
web-dist | ||
npm-debug.log |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,44 +1,44 @@ | ||
import PDFJSAnnotate from '../PDFJSAnnotate'; | ||
import { | ||
findAnnotationAtPoint, | ||
findSVGAtPoint | ||
} from './utils'; | ||
|
||
let _canerase = false; | ||
|
||
function handleDocumentMouseDown(e){ | ||
_canerase = true; | ||
} | ||
|
||
function handleDocumentMouseUp(e){ | ||
_canerase = false; | ||
} | ||
|
||
function handleDocumentMouseMove(e){ | ||
if(_canerase){ | ||
let target = findAnnotationAtPoint(e.clientX, e.clientY); | ||
if(target){ | ||
console.log(target); | ||
let annotationId = target.getAttribute('data-pdf-annotate-id'); | ||
// let nodes = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`); | ||
// let svg = overlay.parentNode.querySelector(config.annotationSvgQuery()); | ||
// let { documentId } = getMetadata(svg); | ||
|
||
// [...nodes].forEach((n) => { | ||
// n.parentNode.removeChild(n); | ||
// }); | ||
|
||
// PDFJSAnnotate.getStoreAdapter().deleteAnnotation(documentId, annotationId); | ||
} | ||
} | ||
} | ||
|
||
export function enableEraser(){ | ||
document.addEventListener('mousemove', handleDocumentMouseMove); | ||
document.addEventListener('mousedown', handleDocumentMouseDown); | ||
document.addEventListener('mouseup', handleDocumentMouseUp); | ||
} | ||
|
||
export function disableEraser(){ | ||
document.removeEventListener('mousemove', handleDocumentMouseMove); | ||
import PDFJSAnnotate from '../PDFJSAnnotate'; | ||
import { | ||
findAnnotationAtPoint, | ||
findSVGAtPoint | ||
} from './utils'; | ||
|
||
let _canerase = false; | ||
|
||
function handleDocumentMouseDown(e){ | ||
_canerase = true; | ||
} | ||
|
||
function handleDocumentMouseUp(e){ | ||
_canerase = false; | ||
} | ||
|
||
function handleDocumentMouseMove(e){ | ||
if(_canerase){ | ||
let target = findAnnotationAtPoint(e.clientX, e.clientY); | ||
if(target){ | ||
console.log(target); | ||
let annotationId = target.getAttribute('data-pdf-annotate-id'); | ||
// let nodes = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`); | ||
// let svg = overlay.parentNode.querySelector(config.annotationSvgQuery()); | ||
// let { documentId } = getMetadata(svg); | ||
|
||
// [...nodes].forEach((n) => { | ||
// n.parentNode.removeChild(n); | ||
// }); | ||
|
||
// PDFJSAnnotate.getStoreAdapter().deleteAnnotation(documentId, annotationId); | ||
} | ||
} | ||
} | ||
|
||
export function enableEraser(){ | ||
document.addEventListener('mousemove', handleDocumentMouseMove); | ||
document.addEventListener('mousedown', handleDocumentMouseDown); | ||
document.addEventListener('mouseup', handleDocumentMouseUp); | ||
} | ||
|
||
export function disableEraser(){ | ||
document.removeEventListener('mousemove', handleDocumentMouseMove); | ||
} |
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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import { addEventListener, removeEventListener, fireEvent } from './event'; | ||
import { disableEdit, enableEdit } from './edit'; | ||
import { disablePen, enablePen, setPen } from './pen'; | ||
import { enableEraser, disableEraser } from './eraser'; | ||
import { disableArrow, enableArrow, setArrow } from './arrow'; | ||
import { disablePoint, enablePoint } from './point'; | ||
import { disableRect, enableRect } from './rect'; | ||
import { disableCircle, enableCircle, setCircle, addCircle } from './circle'; | ||
import { disableText, enableText, setText } from './text'; | ||
import { createPage, renderPage } from './page'; | ||
|
||
export default { | ||
addEventListener, removeEventListener, fireEvent, | ||
disableEdit, enableEdit, | ||
disablePen, enablePen, setPen, | ||
enableEraser, disableEraser, | ||
disablePoint, enablePoint, | ||
disableRect, enableRect, | ||
disableCircle, enableCircle, setCircle, addCircle, | ||
disableArrow, enableArrow, setArrow, | ||
disableText, enableText, setText, | ||
createPage, renderPage | ||
}; | ||
import { addEventListener, removeEventListener, fireEvent } from './event'; | ||
import { disableEdit, enableEdit } from './edit'; | ||
import { disablePen, enablePen, setPen } from './pen'; | ||
import { enableEraser, disableEraser } from './eraser'; | ||
import { disableArrow, enableArrow, setArrow } from './arrow'; | ||
import { disablePoint, enablePoint } from './point'; | ||
import { disableRect, enableRect } from './rect'; | ||
import { disableCircle, enableCircle, setCircle, addCircle } from './circle'; | ||
import { disableText, enableText, setText } from './text'; | ||
import { createPage, renderPage } from './page'; | ||
|
||
export default { | ||
addEventListener, removeEventListener, fireEvent, | ||
disableEdit, enableEdit, | ||
disablePen, enablePen, setPen, | ||
enableEraser, disableEraser, | ||
disablePoint, enablePoint, | ||
disableRect, enableRect, | ||
disableCircle, enableCircle, setCircle, addCircle, | ||
disableArrow, enableArrow, setArrow, | ||
disableText, enableText, setText, | ||
createPage, renderPage | ||
}; |
Oops, something went wrong.