blob: d4b690d10f8510975d6ec0546536ee8435d8246a (
plain) (
blame)
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Pixel Pixel Pixel Pixel Pixel Pixel</title>
<meta name="description" content="Draw me a goblin, please.">
<style>
body, html {
margin: 0;
padding: 0;
overflow: hidden;
background-color: teal;
}
button {
padding: 0.5rem 0.75rem;
font-size: 1rem;
cursor: pointer;
min-height: 2.75rem;
}
#canvas {
display: block;
}
#palette {
position: fixed;
top: 0.625rem;
right: 0.625rem;
background-color: beige;
padding: 0.625rem;
border: 1px solid #ccc;
border-radius: 0.3125rem;
width: 10.625rem;
transition: transform 0.3s ease-out;
max-height: 90vh;
overflow-y: auto;
scrollbar-width: none;
-ms-overflow-style: none;
box-sizing: border-box;
}
#palette.hidden {
transform: translateX(calc(100% + 1.25rem));
}
#palette-toggle {
position: fixed;
top: 0.625rem;
right: 0.625rem;
background-color: beige;
border: 1px solid #ccc;
border-radius: 0.3125rem 0 0 0.3125rem;
padding: 0.75rem;
cursor: pointer;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.3s ease-out;
min-width: 2.75rem;
min-height: 2.75rem;
font-size: 1.125rem;
}
#palette-toggle:not(.hidden) {
transform: translateX(-11.25rem);
}
#palette label,
#palette input,
#palette button {
display: block;
margin-bottom: 0.75rem;
width: 100%;
}
.color-history {
display: flex;
flex-wrap: wrap;
margin-top: 0.625rem;
}
.color-history div {
width: 1.25rem;
height: 1.25rem;
border: 1px solid #000;
cursor: pointer;
margin-right: 0.3125rem;
margin-bottom: 0.3125rem;
}
.zoom-controls {
display: flex;
gap: 0.3125rem;
margin-top: 0.625rem;
}
.zoom-controls button {
flex: 1;
padding: 0.5rem;
min-height: 2.75rem;
font-size: 1.125rem;
}
.pan-controls {
display: flex;
flex-direction: column;
gap: 0.3125rem;
margin-top: 0.625rem;
align-items: center;
}
.pan-middle {
display: flex;
gap: 0.3125rem;
width: 100%;
}
.pan-controls button {
padding: 0.5rem;
width: 2.75rem;
height: 2.75rem;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.125rem;
}
#centerViewBtn {
margin-top: 0.625rem;
}
@media (max-width: 48rem) { /* 768px */
#palette {
width: 12.5rem;
top: auto;
bottom: 0.625rem;
}
#palette-toggle {
top: auto;
bottom: 0.625rem;
}
#palette-toggle:not(.hidden) {
transform: translateX(-12.5rem);
}
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<button id="palette-toggle">☰</button>
<div id="palette">
<div style="display: flex; gap: 5px; margin-bottom: 10px;">
<div style="flex: 1;">
<label for="gridWidth">W:</label>
<input type="number" id="gridWidth" value="16" min="1" style="width: 90%;">
</div>
<div style="flex: 1;">
<label for="gridHeight">H:</label>
<input type="number" id="gridHeight" value="16" min="1" style="width: 90%;">
</div>
</div>
<br>
<label for="colorPicker">Select Color:</label>
<input type="color" id="colorPicker" value="#000000">
<div id="colorHistory" class="color-history"></div>
<div class="zoom-controls">
<button id="zoomInBtn">🔍+</button>
<button id="zoomOutBtn">🔍-</button>
</div>
<div class="pan-controls">
<button id="panUpBtn">⬆️</button>
<div class="pan-middle">
<button id="panLeftBtn">⬅️</button>
<button id="panRightBtn">➡️</button>
</div>
<button id="panDownBtn">⬇️</button>
</div>
<button id="centerViewBtn">🎯 Center View</button>
<hr>
<button id="exportBtn">Export as PNG</button>
<button id="resetBtn">Reset</button>
</div>
<script src="app.js"></script>
</body>
</html>
|