Skip to content

Commit

Permalink
Merge pull request #124 from yktsr/123-fix-a-bug-related-to-picture-p…
Browse files Browse the repository at this point in the history
…ositioning

123 fix a bug related to picture positioning
  • Loading branch information
yktsr authored Feb 28, 2024
2 parents dc5ce80 + 055bbb9 commit bfeec1f
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Text2Frame.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const require$$1 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1
PATH_SEP = path.sep;
BASE_PATH = path.dirname(process.mainModule.filename);
}
return { path_sep: PATH_SEP, base_path: BASE_PATH };
return { PATH_SEP, BASE_PATH };
};
const getDefaultPage = function() {
return {
Expand Down Expand Up @@ -1074,7 +1074,7 @@ const require$$1 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1
if (origin.toLowerCase() === "center" || origin === "中央") {
out.origin = 1;
}
const constant_regexp = /^[0-9]+$/;
const constant_regexp = /^-?[0-9]+$/;
const variable_regexp = /(?:variables|v|)\[([0-9]+)\]/i;
const x = values[1] || "0";
if (x.match(constant_regexp)) {
Expand Down
4 changes: 2 additions & 2 deletions Text2Frame.es.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const require$$1 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1
PATH_SEP = path.sep;
BASE_PATH = path.dirname(process.mainModule.filename);
}
return { path_sep: PATH_SEP, base_path: BASE_PATH };
return { PATH_SEP, BASE_PATH };
};
const getDefaultPage = function() {
return {
Expand Down Expand Up @@ -1073,7 +1073,7 @@ const require$$1 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1
if (origin.toLowerCase() === "center" || origin === "中央") {
out.origin = 1;
}
const constant_regexp = /^[0-9]+$/;
const constant_regexp = /^-?[0-9]+$/;
const variable_regexp = /(?:variables|v|)\[([0-9]+)\]/i;
const x = values[1] || "0";
if (x.match(constant_regexp)) {
Expand Down
4 changes: 3 additions & 1 deletion Text2Frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// 2.2.2 2024/02/27:
// ・#123 ピクチャの表示・移動において基点の座標にマイナスを設定できない不具合を修正
// 2.2.1 2024/01/08:
// ・#117 中核の変換処理をESModule化し、compile関数を通じて外部のJavascriptプログラムから呼び出せるようにリファクタ
// - コマンドライン上で、パイプでテキストファイルを受け取って、標準出力へイベントに変換されたJSONを書き出すcompileモードの追加
Expand Down Expand Up @@ -5138,7 +5140,7 @@
if (origin.toLowerCase() === 'center' || origin === '中央') {
out.origin = 1
}
const constant_regexp = /^[0-9]+$/
const constant_regexp = /^-?[0-9]+$/
const variable_regexp = /(?:variables|v|)\[([0-9]+)\]/i
const x = values[1] || '0'
if (x.match(constant_regexp)) {
Expand Down
4 changes: 2 additions & 2 deletions Text2Frame.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
PATH_SEP = path.sep;
BASE_PATH = path.dirname(process.mainModule.filename);
}
return { path_sep: PATH_SEP, base_path: BASE_PATH };
return { PATH_SEP, BASE_PATH };
};
const getDefaultPage = function() {
return {
Expand Down Expand Up @@ -1077,7 +1077,7 @@
if (origin.toLowerCase() === "center" || origin === "中央") {
out.origin = 1;
}
const constant_regexp = /^[0-9]+$/;
const constant_regexp = /^-?[0-9]+$/;
const variable_regexp = /(?:variables|v|)\[([0-9]+)\]/i;
const x = values[1] || "0";
if (x.match(constant_regexp)) {
Expand Down
66 changes: 65 additions & 1 deletion test/56-expected_show-picture.json
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,70 @@
0
]
},
{
"code": 231,
"indent": 0,
"parameters": [
15,
"Book",
0,
0,
-1,
-2,
100,
100,
255,
0
]
},
{
"code": 231,
"indent": 0,
"parameters": [
15,
"Book",
1,
0,
-30,
-400,
100,
100,
255,
0
]
},
{
"code": 231,
"indent": 0,
"parameters": [
25,
"Book",
0,
0,
0,
0,
100,
100,
255,
0
]
},
{
"code": 231,
"indent": 0,
"parameters": [
25,
"Book",
0,
0,
0,
0,
100,
100,
255,
0
]
},
{
"code": 0,
"indent": 0,
Expand All @@ -463,4 +527,4 @@
]
}
]
}
}
15 changes: 15 additions & 0 deletions test/56-show-picture.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,18 @@
% 拡大率の境界値のチェック
<ShowPicture: 1, Book, Scale[0][0]>
<ShowPicture: 1, Book, Scale[1][1]>


% 位置のX座標とY座標に負の値を設定する場合のチェック
%% ピクチャ番号15に、Book.pngを、左上を基準として、X座標は-1, Y座標は-2として表示
<ShowPicture: 15, Book, Position[Upper Left][-1][-2]>

%% ピクチャ番号15, Book.pngを、中心を基準として、X座標は-30, Y座標は-400
<ShowPicture: 15, Book, Position[Center][-30][-400]>

% Positionに[0][0]を入れた時の確認
<ShowPicture: 25, Book, Position[Upper Left][0][0]>

% Positionに[-0][-0]を入れた時の確認
<ShowPicture: 25, Book, Position[Upper Left][-0][-0]>

78 changes: 77 additions & 1 deletion test/57-expected_move-picture.json
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,82 @@
0
]
},
{
"code": 232,
"indent": 0,
"parameters": [
15,
0,
0,
0,
-1,
-2,
100,
100,
255,
0,
60,
true,
0
]
},
{
"code": 232,
"indent": 0,
"parameters": [
15,
0,
1,
0,
-30,
-400,
100,
100,
255,
0,
60,
true,
0
]
},
{
"code": 232,
"indent": 0,
"parameters": [
25,
0,
0,
0,
0,
0,
100,
100,
255,
0,
60,
true,
0
]
},
{
"code": 232,
"indent": 0,
"parameters": [
25,
0,
0,
0,
0,
0,
100,
100,
255,
0,
60,
true,
0
]
},
{
"code": 0,
"indent": 0,
Expand All @@ -680,4 +756,4 @@
]
}
]
}
}
13 changes: 13 additions & 0 deletions test/57-move-picture.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,16 @@
% 0はツクールの仕様上ないのでチェックしない
% おそらく入れてしまうとゲーム実行時にゼロ割てきなことがおきて止まる
<MovePicture: 1, Duration[1][Wait for Completion]>

% 位置のX座標とY座標に負の値を設定する場合のチェック
%% ピクチャ番号15, 左上を基準として、X座標は-1, Y座標は-2
<MovePicture: 15, Position[Upper Left][-1][-2]>

%% ピクチャ番号15, 中心を基準として、X座標は-30, Y座標は-400
<MovePicture: 15, Position[Center][-30][-400]>

% Positionに[0][0]を入れた時の確認
<MovePicture: 25, Position[Upper Left][0][0]>

% Positionに[-0][-0]を入れた時の確認
<MovePicture: 25, Position[Upper Left][-0][-0]>

0 comments on commit bfeec1f

Please sign in to comment.