Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* doubleback: Save empty cells to file.
* kurochute: Fix error highlighting.
* renban: Fix consecutive number error check.
* shakashaka: Fix alignment of triangles to shaded cells.
* triplace: Don't allow drawing on clues.
* walllogic: Fix redraw with autocompletion.
* yajilin: Fix interaction between edit mode and answer.
Expand Down
4 changes: 2 additions & 2 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
|`use_tri`|`number`|`1`|Input method for triangles from mouse for `'Shakashaka'` <br> Possible value: `1, 2 or 3`|
|`support_tri`|`boolean`|`true`|Enable to support inputting triangles next to two or more walls for `'Shakashaka'`|
|`bgcolor`|`boolean`|`false`|Enable to input background color for `'Slitherlink'`|
|`singlenum`|`boolean`|`true`|Disable to input plural answer numbers in a room for `'Hanare-gumi'`|
|`singlenum`|`boolean`|`true`|Disable to input multiple answer numbers in a room for `'Hanare-gumi'`|
|`enline`|`boolean`|`true`|Limit to input segments only between points for `'Kouchoku'`|
|`lattice`|`boolean`|`true`|Restrict not to input segments if other points are on the lattice for `'Kouchoku'`|

Expand All @@ -34,7 +34,7 @@
|---|---|---|---|
|`autocmp`|`boolean`|`true`|Show complete numbers apart from incompleted one automatically.|
|`autoerr`|`boolean`|`false`|Show incomplete/wrong numbers automatically.|
|`multierr`|`boolean`|`false`|Check plural errors in `puzzle.check()` API.|
|`multierr`|`boolean`|`false`|Check multiple errors in `puzzle.check()` API.|
|`forceallcell`|`boolean`|`false`|Force all cells to have number to get completed for `'fillomino'`|
|`passallcell`|`boolean`|`true`|Force all cells to be passed for `'arukone'`|

Expand Down
2 changes: 1 addition & 1 deletion docs/Puzzle.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,4 @@ For details, see [list of puzzle config document](Config.md).
|`autocmp_area`|`boolean`|`false`|Paint background of completed blocks/areas automatically.|
|`autocmp_border`|`boolean`|`false`|Paint borders between different blocks/areas automatically.|
|`autoerr`|`boolean`|`false`|Show incomplete/wrong numbers automatically.|
|`multierr`|`boolean`|`false`|Check plural errors in `puzzle.check()` API.|
|`multierr`|`boolean`|`false`|Check multiple errors in `puzzle.check()` API.|
9 changes: 9 additions & 0 deletions src-ui/js/ui/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ ui.event = {

// onunloadイベントを割り当てる
this.addEvent(window, "unload", this, this.onunload_func);

if (!!matchMedia) {
var mqString = "(resolution: 1dppx)";
matchMedia(mqString).addListener(this.onpixelratiochange_func);
}
},

setDocumentEvents: function() {
Expand Down Expand Up @@ -145,5 +150,9 @@ ui.event = {
this.visibilityCallbacks = [];
}
}
},

onpixelratiochange_func: function(e) {
ui.puzzle.redraw(true);
}
};
3 changes: 0 additions & 3 deletions src-ui/js/ui/MenuArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,6 @@ ui.menuarea = {
ui.menuconfig.set("toolarea", !ui.menuconfig.get("toolarea"));
ui.displayAll();
},
repaint: function() {
ui.puzzle.redraw(true);
},
disppopup: function(e) {
var el = e.target;
if (el.nodeName === "SPAN") {
Expand Down
17 changes: 16 additions & 1 deletion src/puzzle/Graphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@
bw: 18, // セルの横幅/2
bh: 18, // セルの縦幅/2

devicePixelRatio: 1,
gw: 1, // grid width
lw: 1, // LineWidth 境界線・Lineの太さ
lwmin: 3,
lm: 1, // LineMargin
Expand Down Expand Up @@ -294,6 +296,10 @@
var cw = (cwid / cols) | 0,
ch = (chgt / rows) | 0;

this.devicePixelRatio = this.puzzle.pzpr.env.browser
? window.devicePixelRatio || 1
: 1;

if (this.puzzle.getConfig("squarecell")) {
this.cw = this.ch = Math.min(cw, ch);
} else {
Expand All @@ -304,7 +310,16 @@
this.bw = this.cw / 2;
this.bh = this.ch / 2;

this.lw = Math.max(this.cw / this.lwratio, this.lwmin);
var gwmax = 1,
gwratio = 40;
var gw = Math.min(this.cw / gwratio, gwmax);
var pxSize = 1 / this.devicePixelRatio;
var gwdev = Math.max(1, Math.round(gw / pxSize));
this.gw = gwdev * pxSize;

var lw = Math.max(this.cw / this.lwratio, this.lwmin);
var lwdev = Math.max(1, Math.round(lw / pxSize));
this.lw = lwdev * pxSize;
this.lm = this.lw / 2;
},
setOffset: function() {
Expand Down
10 changes: 5 additions & 5 deletions src/variety-common/Graphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ pzpr.classmgr.makeCommon({
// pc.drawTriangle1() 三角形をCanvasに書き込む(1マスのみ)
//---------------------------------------------------------------------------
drawTriangle: function() {
var g = this.vinc("cell_triangle", "auto");
var g = this.vinc("cell_triangle", "crispEdges");

var clist = this.range.cells;
for (var i = 0; i < clist.length; i++) {
Expand All @@ -1327,7 +1327,7 @@ pzpr.classmgr.makeCommon({
},
drawTriangle1: function(px, py, num) {
var g = this.context;
var mgn = this.pid === "reflect" ? 1 : 0,
var mgn = this.pid === "reflect" ? 1 : 0.5,
bw = this.bw + 1 - mgn,
bh = this.bh + 1 - mgn;
g.beginPath();
Expand Down Expand Up @@ -2057,7 +2057,7 @@ pzpr.classmgr.makeCommon({
},

getDashArray: function() {
var dashCount = Math.max(Math.round(this.cw / 10), 3);
var dashCount = Math.max(Math.round(this.cw / 10), 4);
var stepSize = this.cw / dashCount;
var lengthOn = (5 / 8) * stepSize;
var lengthOff = stepSize - lengthOn;
Expand Down Expand Up @@ -2118,7 +2118,7 @@ pzpr.classmgr.makeCommon({
yb = Math.min(y2, maxy - bs);

// isdraw!==false: 指定無しかtrueのときは描画する
g.lineWidth = 1;
g.lineWidth = this.gw;
g.strokeStyle = this.gridcolor;
for (var i = xa; i <= xb; i += 2) {
g.vid = "bdy_" + i;
Expand Down Expand Up @@ -2185,7 +2185,7 @@ pzpr.classmgr.makeCommon({
var ya = Math.max(y1, miny + bs),
yb = Math.min(y2, maxy - bs);

g.lineWidth = 1;
g.lineWidth = this.gw;
g.strokeStyle = this.gridcolor;
for (var i = xa; i <= xb; i += 2) {
var px = i * bw,
Expand Down
10 changes: 5 additions & 5 deletions src/variety/country.js
Original file line number Diff line number Diff line change
Expand Up @@ -1034,24 +1034,24 @@
"FailCode@onsen": {
blPassTwice: [
"ある線が1つの部屋を2回以上通っています。",
"A line passes a room twice or more."
"A line passes a room more than once."
],
blLineNe: [
"線が通過するマスの数が数字と違います。",
"The Length of the path in a room is different from the number of the loop."
"The length of the path in a room is different from the number of the loop."
],
blLineDiff: [
"各部屋で線が通過するマスの数が違います。",
"The Length of the path in a room is different in each room."
"The length of the path in a room is different in some rooms."
],
bkNoLine: ["線の通っていない部屋があります。", "A room remains blank."],
lnIsolate: [
"線の通っていない○があります。",
"Lines doesn't pass a circle."
"A circle doesn't have a line."
],
lpNumGt2: [
"数字が2つ以上含まれたループがあります。",
"A loop has plural numbers."
"A loop has more than one number."
],
lpNoNum: ["○を含んでいないループがあります。", "A loop has no numbers."]
},
Expand Down
10 changes: 5 additions & 5 deletions src/variety/fillmat.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,23 @@
],
bkNumGe2: [
"1つのタタミに2つ以上の数字が入っています。",
"A tatami has plural numbers."
"A tatami has more than one number."
],
bkSizeNe: [
"数字とタタミの大きさが違います。",
"The size of tatami and the number written in Tatami is different."
"The number is different from the size of the tatami."
],
bkSizeEq: [
"数字とタタミの大きさが同じです。",
"The size of tatami and the number is the same."
"The number is equal to the size of the tatami."
],
bkLenGt4: [
"「幅1マス、長さ1~4マス」ではないタタミがあります。",
"The width of Tatami is over 1 or the length is over 4."
"The width of the tatami is more than one, or the length is more than four."
],
bsSizeEq: [
"隣り合うタタミの大きさが同じです。",
"The same size Tatami are adjacent."
"Tatamis of the same size are adjacent."
]
}
});
10 changes: 5 additions & 5 deletions src/variety/hakoiri.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,23 +316,23 @@
FailCode: {
bkDupNum: [
"1つのハコに同じ記号が複数入っています。",
"A box has same plural marks."
"A box has duplicate shapes."
],
bkNumGt3: [
"1つのハコに4つ以上の記号が入っています。",
"A box has four or more marks."
"A box has more than three shapes."
],
bkNumLt3: [
"1つのハコに2つ以下の記号しか入っていません。",
"A box has tow or less marks."
"A box has less than three shapes."
],
nmDivide: [
"タテヨコにつながっていない記号があります。",
"Marks are divided."
"The shapes are divided."
],
nmAround: [
"同じ記号がタテヨコナナメに隣接しています。",
"Same marks are adjacent."
"Equal shapes touch."
]
}
});
4 changes: 2 additions & 2 deletions src/variety/hanare.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,15 @@
bkNoNum: ["数字の入っていない部屋があります。", "A room has no numbers."],
bkNumGe2: [
"1つの部屋に2つ以上の数字が入っています。",
"A room has plural numbers."
"A room has more than one number."
],
bkSizeNe: [
"数字と部屋の大きさが違います。",
"The size of the room is not equal to the number."
],
nmDiffDistNe: [
"2つの数字の差とその間隔が正しくありません。",
"The distance of the paired numbers is not equal to the diff of them."
"The distance of the paired numbers is not equal to their difference."
]
}
});
6 changes: 3 additions & 3 deletions src/variety/hebi.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,15 +502,15 @@
},

FailCode: {
bkDupNum: ["同じ数字が入っています。", "A Snake has same plural marks."],
bkDupNum: ["同じ数字が入っています。", "A snake has duplicate numbers."],
bkSizeNe5: [
"大きさが5ではない蛇がいます。",
"The size of a snake is not five."
],
bsSnake: ["別々の蛇が接しています。", "Other snakes are adjacent."],
bsSnake: ["別々の蛇が接しています。", "Different snakes are adjacent."],
anNumberNe: [
"矢印の先にある数字が正しくありません。",
"There is a wrong number which is in front of the arrowed number."
"A clue points at the wrong number."
],
snakeAttack: [
"蛇の視線の先に別の蛇がいます。",
Expand Down
16 changes: 9 additions & 7 deletions src/variety/kaero.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,15 @@
"FailCode@kaero": {
bkNoNum: [
"アルファベットのないブロックがあります。",
"A block has no letters."
"An area has no letters."
],
bkPlNum: [
"1つのブロックに異なるアルファベットが入っています。",
"A block has plural kinds of letters."
"An area has more than one kind of letter."
],
bkSepNum: [
"同じアルファベットが異なるブロックに入っています。",
"Same kinds of letters are placed different blocks."
"Letters of one kind are placed in different areas."
]
},
"FailCode@armyants": {
Expand All @@ -569,12 +569,14 @@
"線が境界線をまたいでいます。",
"There is a line across a border."
],
bsAnt: ["別々のアリが接しています。", "Other ants are adjacent."],
bkWrongNum: ["アリの数字がおかしいです。", "Numbers on the ant is wrong."],
bsAnt: ["別々のアリが接しています。", "Two ants are adjacent."],
bkWrongNum: [
"アリの数字がおかしいです。",
"The numbers on the ant are wrong."
],
ceNumGtSize: [
"数字がアリの大きさよりも大きいです。",
"A number is greater than the size of the ant."
],
nmBranch: ["アリが分岐しています。", "An ant could have branch."]
]
}
});
6 changes: 3 additions & 3 deletions src/variety/kinkonkan.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,15 +757,15 @@
bkNoObj: ["斜線の引かれていない部屋があります。", "A room has no mirrors."],
bkObjGe2: [
"斜線が複数引かれた部屋があります。",
"A room has plural mirrors."
"A room has more than one mirror."
],
pairedLetterNe: [
"光が同じ文字の場所へ到達しません。",
"Beam from a light doesn't reach one's pair."
"Beam from a light doesn't reach its pair."
],
pairedNumberNe: [
"光の反射回数が正しくありません。",
"The count of refrection is wrong."
"The number of reflections is wrong."
]
}
});
2 changes: 1 addition & 1 deletion src/variety/nawabari.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
bkNoNum: ["数字の入っていない部屋があります。", "A room has no numbers."],
bkNumGe2: [
"1つの部屋に2つ以上の数字が入っています。",
"A room has plural numbers."
"A room has more than one number."
],
bkSizeLt3: [
"サイズが3マスより小さいブロックがあります。",
Expand Down
14 changes: 7 additions & 7 deletions src/variety/nurikabe.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,36 +363,36 @@
],
bkNumGe2: [
"1つのシマに2つ以上の数字が入っています。",
"An area of unshaded cells has plural numbers."
"An area of unshaded cells has more than one number."
],
bkSizeNe: [
"数字とシマの面積が違います。",
"The number is not equal to the number of the size of the area."
"The number is not equal to the size of the area."
]
},
"FailCode@nuribou": {
csWidthGt1: [
"「幅1マス、長さ1マス以上」ではない黒マスのカタマリがあります。",
"There is a mass of shaded cells, whose width is more than two."
"There is a mass of shaded cells whose width is more than two."
],
csCornerSize: [
"同じ面積の黒マスのカタマリが、角を共有しています。",
"Masses of shaded cells whose length is the same share a corner."
"Masses of shaded cells with the same length share a corner."
]
},

"FailCode@mochikoro,mochinyoro": {
cuNotRect: [
"四角形でない白マスのブロックがあります。",
"There is a block of unshaded cells that is not rectangle."
"There is a block of unshaded cells that is not a rectangle."
],
csRect: [
"四角形になっている黒マスのブロックがあります。",
"There is a block of shaded cells that is rectangle."
"There is a block of shaded cells that is a rectangle."
],
csDivide8: [
"孤立した白マスのブロックがあります。",
"Unshaded cells are divided."
"The unshaded cells are divided."
]
}
});
2 changes: 1 addition & 1 deletion src/variety/roma.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
FailCode: {
bkDupNum: [
"1つの領域に2つ以上の同じ矢印が入っています。",
"An area has plural same arrows."
"An area has duplicate arrows."
],
stopHalfway: [
"ゴールにたどり着かないセルがあります。",
Expand Down
Loading