Skip to content

Commit fa67ea1

Browse files
add cell-ui and choose icons
1 parent ef2e8e4 commit fa67ea1

9 files changed

+597
-13
lines changed

public/css/style.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ body{
33
}
44
h2, h3 { display: inline;}
55
.grid { width: 450px; max-width: 450px; position: absolute}
6-
#grid_hint{z-index: 1}
76
#editor { position: absolute; left: 50%; }
87
#dialog {
98
position: absolute;
@@ -41,7 +40,8 @@ h2, h3 { display: inline;}
4140
left: 0;
4241
z-index: 999;
4342
background-color: rgba(100, 100, 100, 0.5); }
44-
.cell { width: 150px; height: 150px; position:absolute}
43+
.cell, .cellUi { width: 150px; height: 150px; position:absolute}
44+
.cellUi > span{ position: relative; margin: 5px; float: right }
4545
.hint { width: 148px; height: 148px; position:absolute;border: 1px solid rgba(0,0,0,0);}
4646
.visible-grid, .visible-cell{ border: 1px solid rgba(200, 200, 200, 0.5); }
4747
.code_invalid { border: solid rgb(255, 0, 0); }

public/exquis.js

+29-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ define(["iter2d", "csshelper"], function(iter2d, csshelper){
99
cell = {};
1010

1111
cell.canvasAnim = makeCanvasAnimation(context, animationCode);
12-
cell.hint = makeHint(row, col, height, width);
12+
cell.hint = createCellDiv("hint", row, col, height, width);
13+
cell.ui = makeCellUi(row, col, height, width);
1314

1415
return cell;
1516
};
@@ -36,7 +37,7 @@ define(["iter2d", "csshelper"], function(iter2d, csshelper){
3637
return;
3738
}
3839

39-
// force reset matrix
40+
// force reset matrix/
4041
context.setTransform(1, 0, 0, 1, 0, 0);
4142
this.currentAnimation.draw(context, borders, this.lib);
4243
},
@@ -76,17 +77,34 @@ define(["iter2d", "csshelper"], function(iter2d, csshelper){
7677
return canvas;
7778
};
7879

79-
var makeHint = function(row, col, height, width){
80-
var gridHint = document.createElement('div');
81-
gridHint.id = "hint-" + row + "-" + col;
82-
gridHint.className = "hint";
83-
gridHint.style.top = (height * row)+"px";
84-
gridHint.style.left = (width * col)+"px";
85-
86-
document.getElementById('dashboard').appendChild(gridHint);
87-
return gridHint;
80+
var createCellDiv = function(className, row, col, height, width){
81+
var cellDiv = document.createElement('div');
82+
cellDiv.id = className + "-" + row + "-" + col;
83+
cellDiv.className = className;
84+
cellDiv.style.top = (height * row)+"px";
85+
cellDiv.style.left = (width * col)+"px";
86+
87+
document.getElementById('dashboard').appendChild(cellDiv);
88+
return cellDiv;
8889
};
8990

91+
92+
var makeIcon = function(classNames){
93+
var icon = document.createElement('span');
94+
icon.className = classNames;
95+
return icon;
96+
};
97+
98+
var makeCellUi = function(row, col, height, width){
99+
var cellUi = createCellDiv("cellUi", row, col, height, width);
100+
101+
var edit = makeIcon("fa fa-pencil-square-o fa-2x");
102+
var loadAnimation = makeIcon("fa fa-folder-open-o fa-2x");
103+
104+
cellUi.appendChild(loadAnimation);
105+
cellUi.appendChild(edit);
106+
};
107+
90108
var addHintListeners = function(cells){
91109
var showGridHint = function(show){
92110

public/fonts/FontAwesome.otf

91.7 KB
Binary file not shown.

public/fonts/fontawesome-webfont.eot

59.3 KB
Binary file not shown.

public/fonts/fontawesome-webfont.svg

+565
Loading

public/fonts/fontawesome-webfont.ttf

119 KB
Binary file not shown.

public/fonts/fontawesome-webfont.woff

69.8 KB
Binary file not shown.
55.4 KB
Binary file not shown.

public/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<!-- Mobile viewport optimized: h5bp.com/viewport -->
77
<meta name="viewport" content="width=device-width">
88
<link href="/css/style.css" rel="stylesheet">
9+
<link href="/css/font-awesome.min.css" rel="stylesheet">
910
<script data-main="/main.js" src="/lib/require.js"></script>
1011
<script src="/bibs/require-config.js"></script>
1112
<script src="/bibs/include-scripts.js"></script>

0 commit comments

Comments
 (0)