forked from odileeds/hexmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder.html
More file actions
148 lines (132 loc) · 5.93 KB
/
builder.html
File metadata and controls
148 lines (132 loc) · 5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hex map builder</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@ODILeeds">
<meta name="twitter:url" property="og:url" content="https://odileeds.org/projects/hexmaps/builder">
<meta name="twitter:title" property="og:title" content="Hex map builder">
<meta name="twitter:description" property="og:description" content="Create your own point-topped hex map from a data file.">
<meta name="twitter:image" property="og:image" content="https://odileeds.org/projects/hexmaps/hexmap.png">
<link rel="StyleSheet" href="resources/style.css" type="text/css" />
<script type="text/javascript" src="resources/stuquery.js"></script>
<script type="text/javascript" src="resources/stuquery.svg.js"></script>
<script type="text/javascript" src="resources/stuquery.hexmap.js"></script>
<script type="text/javascript" src="resources/builder.js"></script>
<script>
var builder;
S(document).ready(function(){
builder = new HexBuilder('builder',1080,1220,2);
builder.init();
});
</script>
<style>
section { margin-bottom: 1em; }
.chooser { text-align: left; display: flex; line-height: 1.5em; }
.chooser input { font-size:1em; }
.chooser .vs { display: inline; margin: 2.5em 0.5em 0 0.5em; font-family: serif; font-style: italic; color: #666666; text-align: center; vertical-align: middle; }
.chooser .part { position: relative; margin: 0px; width: 100%; display: inline; padding: 1em; line-height: 1.5em; }
.chooser .part input { padding: 0px 2px; }
.chooser .part label { display: block; }
.chooser .choose { display: inline; }
.chooser .choose button { height: 100%; margin-left: 1em; }
#url {
line-height: 1.5em;
width: 100%;
}
form {
position: relative;
}
.dropzone {
line-height: 1.5em;
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
padding: 1em;
box-sizing: border-box;
border: 2px dashed #999999;
}
.dropzone.loaded {
border: 2px solid transparent;
}
.dropzone.loaded .helpertext {
display: none;
}
.dropzone.drop {
background-color: #ddd;
}
.dropzone input {
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
opacity: 0.01;
}
.spinner { position: absolute; left: 50%; top: 50%; transform: translate3d(-50%,-50%,0); z-index: 1000; }
.spinner img { width: 5em; margin: auto; }
#hexmap svg { margin: auto; display: block; }
.hex-cell { fill-opacity: 1; }
.hex-label { fill: white; }
.hex-cell.highlighted { stroke: black!important; stroke-width: 2px!important; }
.hex-cell.not-highlighted { opacity: 0.3!important; }
.hex-cell.hover { stroke: white!important; stroke-width: 5px!important; opacity:1!important; fill-opacity: 1!important; }
.hex-label.hover { fill: white!important; }
.hex-label.selected { fill: black!important;}
.hex-cell.selected { fill: #dfdfdf!important; }
</style>
</head>
<body class="b1-bg">
<div id="main" class="b6-bg">
<header>
<div class="b1-bg">
<div class="holder" style="text-align:center;">
<a href="https://odileeds.org/"><img src="https://odileeds.org/resources/images/odileeds-10.svg" /></a>
<h1>Hex map builder</h1>
</div>
</div>
</header>
<div class="c10-bg">
<div id="messages"></div>
</div>
<div class="holder">
<p>We like <a href="https://odileeds.org/blog/2017-05-08-mapping-election-with-hexes">creating hex maps</a> so we've created a tool to help you make them from your own data. You can either read in an existing <a href="hexjson.html">HexJSON file</a> or start creating your own hex map from a CSV file. The CSV should contain a column with the heading <code class="b5-bg">id</code> that uniquely identifies each hex. Other columns will be added as properties of each hex. You can specify the position of the hex using the column headings <code class="b5-bg">q</code> and <code class="b5-bg">r</code>. A column with the heading <code class="b5-bg">n</code> or <code class="b5-bg">name</code> will set the displayed name of the hex. Once you have hexagons, move them to your desired positions (click one then click an empty hex to move it there). When you everything where you want it, save the output.</p>
<form id="validation_form" method="POST" enctype="multipart/form-data" accept-charset="UTF-8" >
<section class="chooser">
<div class="part b5-bg">
<!--<label for="url">URL</label><input id="url" type="url" name="url" class="" placeholder="e.g. https://odileeds.github.io/hexmaps/data/wards-leeds.csv" pattern="https://.*" />-->
<label for="url">URL</label><input id="url" type="text" name="url" class="" placeholder="e.g. https://odileeds.github.io/hexmaps/data/wards-leeds.csv" />
</div>
<div class="vs">or</div>
<div class="part b5-bg dropzone" id="drop_zone">
<label for="standard_files">File</label>
<div class="helpertext">Drop a .csv or .hexjson file here (or click to browse files)</div>
<input id="standard_files" class="fileselect" type="file" title="browse" name="file" accept=".csv, .hexjson">
</div>
</section>
<button id="submit" type="submit" class="button c10-bg">Hexify</button>
<button id="example" class="c8-bg">Load example</button>
<button id="reset" type="reset" class="c8-bg">Reset</button>
</form>
</div>
<div id="builder">
<div id="hexmap"></div>
<!--
<div class="spinner">
<img src="https://odileeds.org/resources/images/odi.svg" alt="Loading..." />
</div>
-->
<div class="options"></div>
</div>
</div>
<footer class="b1-bg">
<div class="holder">
© 2017-9 <a href="https://odileeds.org/">ODI Leeds</a>. Released under an MIT license. <a href="https://github.com/odileeds/hexmaps">Source on Github</a>.
</div>
</footer>
</body>
</html>