Skip to content

Commit

Permalink
correct misspelling
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyishou committed Jun 9, 2015
1 parent 6bbc3db commit 9ec677f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 58 deletions.
2 changes: 1 addition & 1 deletion css/panel.css
Expand Up @@ -790,7 +790,7 @@ html, body {
left: 3px;
}

.circle-icon.minilize:before {
.circle-icon.minimize:before {
content: "";
width: 14px;
height: 4px;
Expand Down
8 changes: 3 additions & 5 deletions lib/delaunay.js
Expand Up @@ -11,16 +11,16 @@

vertices = vertices.concat();

//create a array base verteices's key
//create a array base vertices's key
for (i = n, indices = new Array(n); i--;) indices[i] = i;
//sort the indices base on the x coordinate of vertice
//sort the indices base on the x coordinate of vertices
//from bigger to smaller
indices.sort(function (a, b) {
return vertices[b][0] - vertices[a][0];
});


//create a supertriangle to buffer and push the vertice to vertices Array
//create a supertriangle to buffer and push the vertex to vertices Array
buffer = supertriangle(vertices);
vertices.push(buffer[0], buffer[1], buffer[2]);

Expand Down Expand Up @@ -96,7 +96,6 @@
xc, yc, m1, m2, mx1, mx2, my1, my2, dx, dy;

if (fabsy1y2 < e) {
//alert(1)
m2 = -((x3 - x2) / (y3 - y2));
mx2 = (x2 + x3) / 2.0;
my2 = (y2 + y3) / 2.0;
Expand All @@ -105,7 +104,6 @@
}

else if (fabsy2y3 < e) {
//alert(2)
m1 = -((x2 - x1) / (y2 - y1));
mx1 = (x1 + x2) / 2.0;
my1 = (y1 + y2) / 2.0;
Expand Down
8 changes: 4 additions & 4 deletions lib/index.js
Expand Up @@ -42,7 +42,7 @@ Polyer.UITools.Alert.show("Loading Image",true,true);
img.onload = function() {
points.createProcessingLine(img, [{type: "gray"}, {type: "blur"}, {type: "edge"}], panel.vertexNum, function () {
points.createPolyMesh(convertHexToRGB(panel.meshColor));
// panel.maxVertexNum = points.getEdgetPoins().length;
// panel.maxVertexNum = points.getEdgePoints().length;
o.emit("points");
});
poly.createOriginal(img, function () {
Expand Down Expand Up @@ -120,7 +120,7 @@ panel.zoomSmaller = function () {
}
panel.onVertexNumChange = function (num) {
//for first panel recovery , onVertexNumChange is called in panel with delay
//so panel recovery will trigger all functions those are null when recoverying
//so panel recovery will trigger all functions those are null when recovering
//after delay end , onVertexNumChange will be trigger , on this time the function
//is already bind to onVertexNumChange , but the webgls maybe not ready because
//these are async.
Expand Down Expand Up @@ -221,7 +221,7 @@ Polyer.Utils.bind(canvas_box, "mouseup", function () {
});

//add tabindex to div for binding keydown
//for binding keydown and keyup to document ,hover for changing edit to "move" whild "remove" or "add"
//for binding keydown and keyup to document ,hover for changing edit to "move" while "remove" or "add"
canvas_box.setAttribute("tabindex", 1);
Polyer.Utils.bind(document, "keydown", (function () {
var store = false;
Expand All @@ -248,7 +248,7 @@ Polyer.Utils.bind(document, "keydown", (function () {
* bind to firstCanvas for "remove" event
* */
Polyer.Utils.bind(firstCanvas, "mousedown", function (e) {
//if edit tool is "move" , propagate event upto canvas_box ,
//if edit tool is "move" , propagate event up to canvas_box ,
//return and trigger canvas_box mousedown event
//if edit tool is "click" , do not trigger mousedown
//so there is only "remove" left
Expand Down
27 changes: 13 additions & 14 deletions lib/panel.js
Expand Up @@ -130,7 +130,7 @@
* */
this.onEditBgColorChange = null;
/*
* @prameters
* @praameters
* color //[String] hex color string
* */
this.onViewBgColorChange = null;
Expand Down Expand Up @@ -269,9 +269,9 @@
Global.panel.removeClass("top").removeClass("bottom");

if (Global.panel.hasClass("mini")) {
Global.panelSizeBtn.removeClass("minilize").addClass("normalize");
Global.panelSizeBtn.removeClass("minimize").addClass("normalize");
} else {
Global.panelSizeBtn.removeClass("normalize").addClass("minilize");
Global.panelSizeBtn.removeClass("normalize").addClass("minimize");
}
break;
case "panelStyle":
Expand Down Expand Up @@ -358,7 +358,7 @@

function initHTML() {
var panelBox = document.createElement("div"),
panelHTML = '<div id="mode-select" class="clear-fix"><label><div class="panel-bg"></div><p>Edit</p><input type="radio" name="mode" value="edit"></label><label class="checked"><div class="panel-bg"></div><p>Sync</p><input type="radio" name="mode" value="sync" checked></label><label><div class="panel-bg"></div><p>View</p><input type="radio" name="mode" value="view"></label></div><ul><li><p><a>Process</a><span class="circle-icon arrow"></span></p><div id="process"><div><div class="control-box"><p>Blur Size<span class="ques" title="Blur grayed picture , to smooth edge of picture .&#10;&#10;Optimum: 2&#10;&#10;Suggestion:&#10;Adjusting with Edit bg is blured visual for finding a best value&#10;when the picture is smooth enough ."></span></p><div class="slider-box control-content"><div class="slider-bar"></div><div class="slider-points"><div></div><div></div><div></div><div></div><div></div></div><div class="slider-btn" id="blur-size-btn"></div><input class="slider-num" type="text" name="blurKernelSize" value="1" autocomplete="off"></div></div><div class="control-box"><p>Edge Size<span class="ques" title="Detect edge of blured picture .&#10;&#10; Optimum : 1&#10;&#10;Suggestion:&#10;Adjusting with Edit bg is edged visual for finding a best value&#10;when the edge is exactly we want ."></span></p><div class="slider-box control-content"><div class="slider-bar"></div><div class="slider-points"><div></div><div></div><div></div><div></div><div></div></div><div class="slider-btn" id="edge-size-btn"></div><input class="slider-num" type="text" name="edgeKernelSize" value="1" autocomplete="off"></div></div><div class="control-box button-box"><span id="use-kernel-change"><a></a><span>Apply Change</span></span></div><div class="control-box bg-select-box clear-fix"><p>Edit bg</p><div class="bg-options-box" id="bg-select"><label class="checked"><div></div>Original<input type="radio" name="bg-select" value="original" checked></label><label><div></div>Blured<input type="radio" name="bg-select" value="blured"></label><label><div></div>Edged<input type="radio" name="bg-select" value="edged"></label></div></div></div></div></li><li><p><a>Edit</a><span class="circle-icon arrow"></span></p><div id="edit-tools"><div><div class="control-box clear-fix"><p>Vertex</p><div class="control-content"><a class="edit-btn edit-add" value="add"><div class="square-icon add"></div>Add</a><a class="edit-btn edit-rm" value="remove"><div class="square-icon remove"></div>Remove</a><br></div></div><div class="control-box clear-fix"><p>View</p><div class="control-content"><a class="edit-btn edit-move selected" value="move" title="Holding space"><div class="square-icon move"><div></div><div></div></div>Move</a><a class="edit-btn edit-zooml" value="zooml" title="MouseWheel Up"><div class="square-icon zooml"><div></div></div>ZoomL</a><a class="edit-btn edit-zooms" value="zooms" title="MouseWheel Down"><div class="square-icon zooms"><div></div></div>ZoomS</a></div></div><div class="control-box clear-fix"><p>Vs Num<span class="ques" title="The num of vertices producing by edge detection .&#10;All vertices will be reseted after adjustment !"></span></p><div class="slider-box control-content"><div class="slider-bar"></div><div class="slider-btn" id="vertex-num-btn"></div><input class="slider-num" type="text" value="4000" autocomplete="off"></div></div></div></div></li><li><p><a>Colors</a><span class="circle-icon arrow"></span></p><div id="color"><div><div class="control-box"><p>Mesh Color</p><div class="control-content"><a type="meshColor"></a></div></div><div class="control-box"><p>Edit Bg</p><div class="control-content"><a type="editBgColor"></a></div></div><div class="control-box"><p>View Bg</p><div class="control-content"><a type="viewBgColor"></a></div></div><div class="control-box"><p>Fill Color<span class="ques" title="Average:&#10;Fill with the average of colors at three vertices in a Delaunay triangle . &#10;&#10;Center&#10;Fill with the color at the center of a Delaunay triangle ."></span></p><div class="control-content" id="fill-color"><label><input type="radio" name="fillColor" value="average">Average</label><label><input type="radio" name="fillColor" value="center" checked>Center</label></div></div></div></div></li></ul><div id="io"><div id="upload" class="button"><input type="file" title="">Upload</div><div id="save" class="button">Save</div></div><div id="mini" class="clear-fix"><a class="edit-btn edit-add" title="Add Vertex" value="add"><span></span></a><a class="edit-btn edit-rm" title="Remove Vertex" value="remove"><span></span></a><a class="edit-btn edit-move selected" title="Move&#10;(Holding Space)" value="move"><span></span></a><a class="edit-btn edit-zooml" title="Zoom Larger&#10;(MouseWheel Up)" value="zooml"><span></span></a><a class="edit-btn edit-zooms" title="Zoom Smaller&#10;(MouseWheel Down)" value="zooms"><span></span></a></div><div id="panel-size" class="circle-icon minilize"></div><div id="panel-move" class="circle-icon move"></div>';
panelHTML = '<div id="mode-select" class="clear-fix"><label><div class="panel-bg"></div><p>Edit</p><input type="radio" name="mode" value="edit"></label><label class="checked"><div class="panel-bg"></div><p>Sync</p><input type="radio" name="mode" value="sync" checked></label><label><div class="panel-bg"></div><p>View</p><input type="radio" name="mode" value="view"></label></div><ul><li><p><a>Process</a><span class="circle-icon arrow"></span></p><div id="process"><div><div class="control-box"><p>Blur Size<span class="ques" title="Blur grayed picture , to smooth edge of picture .&#10;&#10;Optimum: 2&#10;&#10;Suggestion:&#10;Adjusting with Edit bg is blured visual for finding a best value&#10;when the picture is smooth enough ."></span></p><div class="slider-box control-content"><div class="slider-bar"></div><div class="slider-points"><div></div><div></div><div></div><div></div><div></div></div><div class="slider-btn" id="blur-size-btn"></div><input class="slider-num" type="text" name="blurKernelSize" value="1" autocomplete="off"></div></div><div class="control-box"><p>Edge Size<span class="ques" title="Detect edge of blured picture .&#10;&#10; Optimum : 1&#10;&#10;Suggestion:&#10;Adjusting with Edit bg is edged visual for finding a best value&#10;when the edge is exactly we want ."></span></p><div class="slider-box control-content"><div class="slider-bar"></div><div class="slider-points"><div></div><div></div><div></div><div></div><div></div></div><div class="slider-btn" id="edge-size-btn"></div><input class="slider-num" type="text" name="edgeKernelSize" value="1" autocomplete="off"></div></div><div class="control-box button-box"><span id="use-kernel-change"><a></a><span>Apply Change</span></span></div><div class="control-box bg-select-box clear-fix"><p>Edit bg</p><div class="bg-options-box" id="bg-select"><label class="checked"><div></div>Original<input type="radio" name="bg-select" value="original" checked></label><label><div></div>Blured<input type="radio" name="bg-select" value="blured"></label><label><div></div>Edged<input type="radio" name="bg-select" value="edged"></label></div></div></div></div></li><li><p><a>Edit</a><span class="circle-icon arrow"></span></p><div id="edit-tools"><div><div class="control-box clear-fix"><p>Vertex</p><div class="control-content"><a class="edit-btn edit-add" value="add"><div class="square-icon add"></div>Add</a><a class="edit-btn edit-rm" value="remove"><div class="square-icon remove"></div>Remove</a><br></div></div><div class="control-box clear-fix"><p>View</p><div class="control-content"><a class="edit-btn edit-move selected" value="move" title="Holding space"><div class="square-icon move"><div></div><div></div></div>Move</a><a class="edit-btn edit-zooml" value="zooml" title="MouseWheel Up"><div class="square-icon zooml"><div></div></div>ZoomL</a><a class="edit-btn edit-zooms" value="zooms" title="MouseWheel Down"><div class="square-icon zooms"><div></div></div>ZoomS</a></div></div><div class="control-box clear-fix"><p>Vs Num<span class="ques" title="The num of vertices producing by edge detection .&#10;All vertices will be reseted after adjustment !"></span></p><div class="slider-box control-content"><div class="slider-bar"></div><div class="slider-btn" id="vertex-num-btn"></div><input class="slider-num" type="text" value="4000" autocomplete="off"></div></div></div></div></li><li><p><a>Colors</a><span class="circle-icon arrow"></span></p><div id="color"><div><div class="control-box"><p>Mesh Color</p><div class="control-content"><a type="meshColor"></a></div></div><div class="control-box"><p>Edit Bg</p><div class="control-content"><a type="editBgColor"></a></div></div><div class="control-box"><p>View Bg</p><div class="control-content"><a type="viewBgColor"></a></div></div><div class="control-box"><p>Fill Color<span class="ques" title="Average:&#10;Fill with the average of colors at three vertices in a Delaunay triangle . &#10;&#10;Center&#10;Fill with the color at the center of a Delaunay triangle ."></span></p><div class="control-content" id="fill-color"><label><input type="radio" name="fillColor" value="average">Average</label><label><input type="radio" name="fillColor" value="center" checked>Center</label></div></div></div></div></li></ul><div id="io"><div id="upload" class="button"><input type="file" title="">Upload</div><div id="save" class="button">Save</div></div><div id="mini" class="clear-fix"><a class="edit-btn edit-add" title="Add Vertex" value="add"><span></span></a><a class="edit-btn edit-rm" title="Remove Vertex" value="remove"><span></span></a><a class="edit-btn edit-move selected" title="Move&#10;(Holding Space)" value="move"><span></span></a><a class="edit-btn edit-zooml" title="Zoom Larger&#10;(MouseWheel Up)" value="zooml"><span></span></a><a class="edit-btn edit-zooms" title="Zoom Smaller&#10;(MouseWheel Down)" value="zooms"><span></span></a></div><div id="panel-size" class="circle-icon minimize"></div><div id="panel-move" class="circle-icon move"></div>';

panelBox.id = "control-panel";
panelBox.className = "hori top";
Expand All @@ -376,7 +376,7 @@
bindEditTools(THIS);
bindColorSelect(THIS);
bindFillColorChange(THIS);
bindFloder();
bindFolder();
bindIO(THIS);
bindPanelMoveAndResize(THIS);
}
Expand Down Expand Up @@ -732,7 +732,7 @@
list_box.style.width = list_box.style.height = brick_size * colors.length + "px";

Polyer.Utils.bind(list_box, "click", function (e) {
//stop propagate upto document , so achieve hide list_box by clicking out of it
//stop propagate up to document , so achieve hide list_box by clicking out of it
e.stopPropagation();
var x = e.layerX || e.offsetX,
y = e.layerY || e.offsetY,
Expand Down Expand Up @@ -791,13 +791,13 @@


/*
* @for bind flod ULs event
* @for bind fold ULs event
* */
function bindFloder() {
function bindFolder() {
var process = document.getElementById("process"),
edit_tools = document.getElementById("edit-tools"),
color = document.getElementById("color"),
floder = [process, edit_tools, color];
folder = [process, edit_tools, color];

for (var i = 3; i--;) {
(function (node) {
Expand All @@ -811,12 +811,12 @@
node.style.display = "none";
}
});
})(floder[i]);
})(folder[i]);
}
}

/*
* @for bind panel move and minilize or normalize events
* @for bind panel move and minimize or normalize events
* */
function bindPanelMoveAndResize(THIS) {
var panel = document.getElementById("control-panel"),
Expand All @@ -825,10 +825,10 @@

Global.panelSizeBtn = panel_size;

//minilize panel or normalize it
//minimize panel or normalize it
Polyer.Utils.bind(panel_size, "click", function (e) {
panel.toggleClass("mini");
panel_size.toggleClass("minilize");
panel_size.toggleClass("minimize");
panel_size.toggleClass("normalize");
limitPanelPosition(panel);

Expand Down Expand Up @@ -887,7 +887,6 @@
var upload = document.getElementById("upload"),
save = document.getElementById("save"),
input = upload.getChildrenByTagName("input")[0],
saveboxHTML = '',
savebox;

Polyer.Utils.bind(upload,"click",function(){
Expand Down

0 comments on commit 9ec677f

Please sign in to comment.