Skip to content

Commit f0a0efb

Browse files
authored
narrow: Add symbol copying display
1 parent 0d22c28 commit f0a0efb

3 files changed

Lines changed: 63 additions & 4 deletions

File tree

src-ui/p.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ <h2 id="title2">読み込み中です...</h2>
265265
<input type="checkbox">
266266
<span data-disp-pid="hitori">__autoerr.tool.hitori__</span>
267267
<span data-disp-pid="gokigen">__autoerr.tool.gokigen__</span>
268-
<span data-disp-pid="ubahn">__autoerr.tool.ubahn__</span>
268+
<span data-disp-pid="ubahn,narrow">__autoerr.tool.ubahn__</span>
269269
<span data-disp-pid="wagiri">__autoerr.tool.wagiri__</span>
270270
</label>
271271
</div>

src/puzzle/Config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@
442442
pid === "hitori" ||
443443
pid === "gokigen" ||
444444
pid === "wagiri" ||
445+
pid === "narrow" ||
445446
pid === "ubahn";
446447
break;
447448
case "singlenum":

src/variety/nawabari.js

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,17 @@
9292
},
9393
"Cell@narrow": {
9494
maxnum: 4,
95-
disInputHatena: true
95+
qcmp1: 0,
96+
qcmp2: 0,
97+
98+
disInputHatena: true,
99+
displayNum: function() {
100+
var qcmp = this.qcmp1 || this.qcmp2;
101+
if (this.puzzle.execConfig("autoerr") && this.qnum === -1 && qcmp) {
102+
return qcmp;
103+
}
104+
return this.qnum;
105+
}
96106
},
97107
"Cell@subomino": {
98108
maxnum: function() {
@@ -180,6 +190,12 @@
180190
}
181191
},
182192

193+
"Board@narrow": {
194+
addExtraInfo: function() {
195+
this.eqblkgraph = this.addInfoList(this.klass.AreaEqualNumberGraph);
196+
}
197+
},
198+
183199
AreaRoomGraph: {
184200
enabled: true
185201
},
@@ -192,14 +208,46 @@
192208
}
193209
},
194210
"AreaRoomGraph@narrow": {
211+
numprop: "qcmp1",
195212
setExtraData: function(component) {
213+
var prop = this.numprop;
196214
var clist = (component.clist = new this.klass.CellList(
197215
component.getnodeobjs()
198216
));
199217
var numlist = clist.filter(function(cell) {
200218
return cell.isNum();
201219
});
202-
component.num = numlist.length === 1 ? numlist[0].getNum() : -1;
220+
component.num = numlist.length === 1 ? numlist[0].getNum() : 0;
221+
222+
clist.each(function(cell) {
223+
if (cell[prop] !== component.num) {
224+
cell[prop] = component.num;
225+
cell.draw();
226+
}
227+
});
228+
}
229+
},
230+
"AreaEqualNumberGraph:AreaRoomGraph@narrow": {
231+
numprop: "qcmp2",
232+
enabled: true,
233+
relation: {
234+
"cell.ques": "node",
235+
"border.qsub": "separator",
236+
"border.qnum": "separator",
237+
"border.qans": "separator"
238+
},
239+
240+
setComponentRefs: function(obj, component) {
241+
obj.eqblk = component;
242+
},
243+
getObjNodeList: function(nodeobj) {
244+
return nodeobj.eqblknodes;
245+
},
246+
resetObjNodeList: function(nodeobj) {
247+
nodeobj.eqblknodes = [];
248+
},
249+
isedgevalidbylinkobj: function(border) {
250+
return !border.isBorder() && border.qsub;
203251
}
204252
},
205253

@@ -281,6 +329,16 @@
281329
},
282330

283331
"Graphic@narrow": {
332+
getQuesNumberColor: function(cell) {
333+
if (cell.qnum === -1) {
334+
return this.qcmpcolor;
335+
}
336+
if ((cell.error || cell.qinfo) === 1) {
337+
return this.errcolor1;
338+
}
339+
return this.quescolor;
340+
},
341+
284342
drawQuesNumbers: function() {
285343
var g = this.vinc("cell_mark", "auto");
286344

@@ -294,7 +352,7 @@
294352
g.strokeStyle = this.getQuesNumberColor(cell);
295353
var px = cell.bx * this.bw,
296354
py = cell.by * this.bh;
297-
switch (cell.getNum()) {
355+
switch (cell.displayNum()) {
298356
case 1:
299357
g.strokeCircle(px, py, rsize);
300358
break;

0 commit comments

Comments
 (0)