Skip to content

Commit

Permalink
[0445/imgtype-notes:0.4.0] Flat時のステップゾーンの代わりのバーの間隔値設定を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
cwtickle committed Sep 11, 2021
1 parent 97877fd commit c82532c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
23 changes: 16 additions & 7 deletions js/danoni_main.js
Expand Up @@ -2734,7 +2734,7 @@ function preheaderConvert(_dosObj) {
* @param {array} _imgType
*/
function updateImgType(_imgType) {
resetImgs(..._imgType);
resetImgs(_imgType.name, _imgType.extension);
reloadImgObj();
Object.keys(g_imgObj).forEach(key => g_imgObj[key] = `${g_rootPath}${g_imgObj[key]}`);
if (_imgType[1] === undefined && typeof g_presetOverrideExtension === C_TYP_STRING) {
Expand Down Expand Up @@ -2770,19 +2770,25 @@ function headerConvert(_dosObj) {
if (tmpImgTypes.length > 0) {
tmpImgTypes.forEach((tmpImgType, j) => {
const imgTypes = tmpImgType.split(`,`);
obj.imgType[j] = [imgTypes[0], imgTypes[1] || `svg`, setVal(imgTypes[2], true, C_TYP_BOOLEAN)];
obj.imgType[j] = {
name: imgTypes[0],
extension: imgTypes[1] || `svg`,
rotateEnabled: setVal(imgTypes[2], true, C_TYP_BOOLEAN),
flatStepHeight: setVal(imgTypes[3], C_ARW_WIDTH, C_TYP_FLOAT),
};
g_keycons.imgTypes[j] = (imgTypes[0] === `` ? `Original` : imgTypes[0]);
});
}
}

// 末尾にデフォルト画像セットが入るよう追加
if (obj.imgType.findIndex(imgSets => imgSets[0] === ``) === -1) {
obj.imgType.push([``, `svg`, true]);
if (obj.imgType.findIndex(imgSets => imgSets.name === ``) === -1) {
obj.imgType.push({ name: ``, extension: `svg`, rotateEnabled: true });
g_keycons.imgTypes.push(`Original`);
}
g_imgType = g_keycons.imgTypes[0];
g_stateObj.rotateEnabled = true;
g_stateObj.rotateEnabled = obj.imgType[0].rotateEnabled;
g_stateObj.flatStepHeight = obj.imgType[0].flatStepHeight;

// サーバ上の場合、画像セットを再読込(ローカルファイル時は読込済みのためスキップ)
if (!g_isFile) {
Expand Down Expand Up @@ -5785,7 +5791,9 @@ function keyConfigInit(_kcType = g_kcType) {
const setImgType = (_scrollNum = 1) => {
const nextNum = getNextNum(_scrollNum, `imgTypes`, g_imgType);
g_imgType = g_keycons.imgTypes[nextNum];
g_stateObj.rotateEnabled = g_headerObj.imgType[nextNum][2];
g_stateObj.rotateEnabled = g_headerObj.imgType[nextNum].rotateEnabled;
g_stateObj.flatStepHeight = g_headerObj.imgType[nextNum].flatStepHeight;

updateImgType(g_headerObj.imgType[nextNum]);
keyConfigInit(g_kcType);
}
Expand Down Expand Up @@ -7632,7 +7640,8 @@ function MainInit() {
if (g_stateObj.scroll === `Flat` && g_stateObj.d_stepzone === C_FLG_ON) {

// ステップゾーンの代わり
[0, C_ARW_WIDTH].forEach((y, j) => {
const lineY = [(C_ARW_WIDTH - g_stateObj.flatStepHeight) / 2, (C_ARW_WIDTH + g_stateObj.flatStepHeight) / 2];
lineY.forEach((y, j) => {
mainSprite.appendChild(
createColorObject2(`stepBar${j}`, {
x: 0, y: C_STEP_Y + g_posObj.reverseStepY * Number(g_stateObj.reverse === C_FLG_ON) + y,
Expand Down
14 changes: 10 additions & 4 deletions js/danoni_setting.js
Expand Up @@ -118,14 +118,20 @@ const g_presetSettingUse = {
const g_presetFrzStartjdgUse = `false`;

/*
デフォルト画像セットの設定 (セット対象のフォルダ名,拡張子,画像回転有無(true or false)の順に指定)
デフォルト画像セットの設定
(セット対象のフォルダ名, 拡張子, 画像回転有無(true or false), Flat時ステップ間隔の順に指定)
事前に、[img]フォルダ配下にセット対象のサブフォルダを作成し、その中に一式を入れておく必要あり
下記の場合は[classic]フォルダに[png]形式の画像一式をデフォルト画像セットとして使用する
拡張子は、未指定の場合`svg`形式
画像回転有無は、未指定の場合true(回転有り)
未指定の場合のデフォルト値は以下の通り
セット対象のフォルダ名:`` (imgフォルダ直下)
拡張子:`svg`形式
画像回転有無:true(回転有り)
Flat時ステップ間隔:50(px) ※矢印サイズ
*/
// const g_presetImageSets = [``, `classic,png`, `classic-thin,png`, `note,svg,false`];
// const g_presetImageSets = [``, `classic,png`, `classic-thin,png`, `note,svg,false,0`];

// デフォルト画像セット (C_IMG_XXXX, 厳密にはg_imgObj) に対して拡張子の上書きを行うか設定
// 文字列の後ろ3文字をカットして、下記の値を適用する。コメントアウトした場合は、上書きを行わない。
Expand Down
1 change: 1 addition & 0 deletions js/lib/danoni_constants.js
Expand Up @@ -398,6 +398,7 @@ const g_stateObj = {
opacity: 100,

rotateEnabled: true,
flatStepHeight: false,
};

const C_VAL_MAXLIFE = 1000;
Expand Down

0 comments on commit c82532c

Please sign in to comment.