-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
660 additions
and
671 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
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 |
---|---|---|
@@ -1,67 +1,65 @@ | ||
/*global Microdraw*/ | ||
/*global paper*/ | ||
|
||
var ToolAddPoint = { addPoint : (function(){ | ||
var tool = { | ||
var ToolAddPoint = { addPoint : (function() { | ||
var tool = { | ||
|
||
/** | ||
/** | ||
* @function mouseDown | ||
* @param {object} point The point where you clicked (x,y) | ||
* @returns {void} | ||
*/ | ||
mouseDown : function mouseDown(point) { | ||
var hitResult = paper.project.hitTest(point, { | ||
tolerance : Microdraw.tolerance, | ||
stroke : true, | ||
segments : true, | ||
fill : true, | ||
handles : true | ||
}) | ||
Microdraw.newRegionFlag = false; | ||
|
||
if( hitResult ) { | ||
var i, re; | ||
for( i = 0; i < Microdraw.ImageInfo[Microdraw.currentImage].Regions.length; i += 1 ) { | ||
if( Microdraw.ImageInfo[Microdraw.currentImage].Regions[i].path === hitResult.item ) { | ||
re = Microdraw.ImageInfo[Microdraw.currentImage].Regions[i]; | ||
break; | ||
} | ||
} | ||
mouseDown : function mouseDown(point) { | ||
var hitResult = paper.project.hitTest(point, { | ||
tolerance : Microdraw.tolerance, | ||
stroke : true, | ||
segments : true, | ||
fill : true, | ||
handles : true | ||
}); | ||
Microdraw.newRegionFlag = false; | ||
|
||
// select path | ||
if( Microdraw.region && Microdraw.region !== re ) { | ||
Microdraw.region.path.selected = false; | ||
prevRegion = Microdraw.region; | ||
} | ||
Microdraw.selectRegion(re); | ||
if( hitResult ) { | ||
var i, re; | ||
for( i = 0; i < Microdraw.ImageInfo[Microdraw.currentImage].Regions.length; i += 1 ) { | ||
if( Microdraw.ImageInfo[Microdraw.currentImage].Regions[i].path === hitResult.item ) { | ||
re = Microdraw.ImageInfo[Microdraw.currentImage].Regions[i]; | ||
break; | ||
} | ||
} | ||
|
||
// select path | ||
if( Microdraw.region && Microdraw.region !== re ) { | ||
Microdraw.region.path.selected = false; | ||
prevRegion = Microdraw.region; | ||
} | ||
Microdraw.selectRegion(re); | ||
|
||
if( hitResult.type === 'stroke'){ | ||
Microdraw.region.path | ||
.curves[hitResult.location.index] | ||
.divide(hitResult.location); | ||
Microdraw.region.path.fullySelected = true; | ||
Microdraw.commitMouseUndo(); | ||
}; | ||
} else { | ||
if( Microdraw.region ){ | ||
Microdraw.region.path.selected = false | ||
Microdraw.region = null | ||
}; | ||
}; | ||
paper.view.draw(); | ||
}, | ||
if( hitResult.type === 'stroke') { | ||
Microdraw.region.path | ||
.curves[hitResult.location.index] | ||
.divide(hitResult.location); | ||
Microdraw.region.path.fullySelected = true; | ||
Microdraw.commitMouseUndo(); | ||
} | ||
} else if( Microdraw.region ) { | ||
Microdraw.region.path.selected = false; | ||
Microdraw.region = null; | ||
} | ||
paper.view.draw(); | ||
}, | ||
|
||
/** | ||
/** | ||
* @function click | ||
* @desc add an additional point to the selected annotation | ||
* @param {string} prevTool The previous tool to which the selection goes back | ||
* @returns {void} | ||
*/ | ||
click : function click(prevTool) { | ||
Microdraw.navEnabled = false; | ||
Microdraw.handle = null; | ||
} | ||
click : function click(prevTool) { | ||
Microdraw.navEnabled = false; | ||
Microdraw.handle = null; | ||
} | ||
|
||
return tool; | ||
}())} | ||
}; | ||
|
||
return tool; | ||
}())}; |
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,66 +1,64 @@ | ||
/*global Microdraw*/ | ||
/*global paper*/ | ||
|
||
var ToolAddRegion = { addRegion : (function(){ | ||
var tool = { | ||
var ToolAddRegion = { addRegion : (function() { | ||
var tool = { | ||
|
||
/** | ||
/** | ||
* @function mouseDown | ||
* @param {object} point The point where you clicked (x,y) | ||
* @returns {void} | ||
*/ | ||
mouseDown : function mouseDown(point) { | ||
var prevRegion = null | ||
var hitResult = paper.project.hitTest(point, { | ||
tolerance : Microdraw.tolerance, | ||
stroke : true, | ||
segments : true, | ||
fill : true, | ||
handles : true | ||
}) | ||
Microdraw.newRegionFlag = false; | ||
|
||
if( hitResult ) { | ||
var re = Microdraw.ImageInfo[Microdraw.currentImage].Regions.find(region=>region.path === hitResult.item) | ||
mouseDown : function mouseDown(point) { | ||
var prevRegion = null; | ||
var hitResult = paper.project.hitTest(point, { | ||
tolerance : Microdraw.tolerance, | ||
stroke : true, | ||
segments : true, | ||
fill : true, | ||
handles : true | ||
}); | ||
Microdraw.newRegionFlag = false; | ||
|
||
// select path | ||
if( Microdraw.region && Microdraw.region !== re ) { | ||
Microdraw.region.path.selected = false; | ||
prevRegion = Microdraw.region; | ||
} | ||
Microdraw.selectRegion(re); | ||
if( hitResult ) { | ||
var re = Microdraw.ImageInfo[Microdraw.currentImage].Regions.find((region) => region.path === hitResult.item); | ||
|
||
if( prevRegion ) { | ||
var newPath = Microdraw.region.path.unite(prevRegion.path); | ||
Microdraw.removeRegion(prevRegion); | ||
Microdraw.region.path.remove(); | ||
Microdraw.region.path = newPath; | ||
// Microdraw.updateRegionList(); | ||
Microdraw.selectRegion(Microdraw.region); | ||
paper.view.draw(); | ||
Microdraw.commitMouseUndo(); | ||
Microdraw.backToSelect(); | ||
} | ||
} else { | ||
if( Microdraw.region ){ | ||
Microdraw.region.path.selected = false | ||
Microdraw.region = null | ||
}; | ||
}; | ||
paper.view.draw(); | ||
}, | ||
// select path | ||
if( Microdraw.region && Microdraw.region !== re ) { | ||
Microdraw.region.path.selected = false; | ||
prevRegion = Microdraw.region; | ||
} | ||
Microdraw.selectRegion(re); | ||
|
||
if( prevRegion ) { | ||
var newPath = Microdraw.region.path.unite(prevRegion.path); | ||
Microdraw.removeRegion(prevRegion); | ||
Microdraw.region.path.remove(); | ||
Microdraw.region.path = newPath; | ||
// Microdraw.updateRegionList(); | ||
Microdraw.selectRegion(Microdraw.region); | ||
paper.view.draw(); | ||
Microdraw.commitMouseUndo(); | ||
Microdraw.backToSelect(); | ||
} | ||
} else if( Microdraw.region ) { | ||
Microdraw.region.path.selected = false; | ||
Microdraw.region = null; | ||
} | ||
paper.view.draw(); | ||
}, | ||
|
||
/** | ||
/** | ||
* @function click | ||
* @desc add an additional point to the selected annotation | ||
* @param {string} prevTool The previous tool to which the selection goes back | ||
* @returns {void} | ||
*/ | ||
click : function click(prevTool) { | ||
Microdraw.navEnabled = false; | ||
Microdraw.handle = null; | ||
} | ||
click : function click(prevTool) { | ||
Microdraw.navEnabled = false; | ||
Microdraw.handle = null; | ||
} | ||
|
||
return tool; | ||
}())} | ||
}; | ||
|
||
return tool; | ||
}())}; |
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,20 +1,20 @@ | ||
/*global Microdraw*/ | ||
/*global paper*/ | ||
|
||
var ToolCloseMenu = { closeMenu : (function(){ | ||
var tool = { | ||
var ToolCloseMenu = { closeMenu : (function() { | ||
var tool = { | ||
|
||
/** | ||
/** | ||
* @function click | ||
* @desc closeMenu. close the side menu | ||
* @param {string} prevTool The previous tool to which the selection goes back | ||
* @returns {void} | ||
*/ | ||
click : function click(prevTool) { | ||
Microdraw.toggleMenu(); | ||
Microdraw.backToPreviousTool(prevTool); | ||
} | ||
click : function click(prevTool) { | ||
Microdraw.toggleMenu(); | ||
Microdraw.backToPreviousTool(prevTool); | ||
} | ||
|
||
return tool; | ||
}())} | ||
}; | ||
|
||
return tool; | ||
}())}; |
Oops, something went wrong.