Skip to content

Commit

Permalink
[0425/change-tmp-shuffle:0.1.0] 一時的にシャッフルグループ番号を変更する機能を実装
Browse files Browse the repository at this point in the history
  • Loading branch information
cwtickle committed May 11, 2021
1 parent bb5480e commit 7cd8e75
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions js/danoni_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5355,6 +5355,24 @@ function keyConfigInit(_kcType = g_kcType) {
$id(`arrowShadow${_j}`).background = getShadowColor(g_keyObj[`color${keyCtrlPtn}`][_j], arrowColor);
};

/**
* 一時的にシャッフルグループ番号を変更
* @param {number} _j
* @param {number} _scrollNum
*/
const changeTmpShuffleNum = (_j, _scrollNum = 1) => {
const baseKeyCtrlPtn = !g_stateObj.extraKeyFlg ? g_localKeyStorage.keyCtrlPtn : g_localStorage[`keyCtrlPtn${g_keyObj.currentKey}`];
const basePtn = `${g_keyObj.currentKey}_${baseKeyCtrlPtn}`;

const tmpShuffle = (g_keyObj[`shuffle${keyCtrlPtn}`][_j] + 10 + _scrollNum) % 10;
document.getElementById(`sArrow${_j}`).textContent = tmpShuffle + 1;
g_keyObj[`shuffle${keyCtrlPtn}`][_j] = g_keyObj[`shuffle${basePtn}`][_j] = tmpShuffle;
if (g_keyObj[`shuffle${keyCtrlPtn}_1`] !== undefined) {
g_keyObj[`shuffle${keyCtrlPtn}_${g_keycons.shuffleGroupNum}`][_j] =
g_keyObj[`shuffle${basePtn}_${g_keycons.shuffleGroupNum}`][_j] = tmpShuffle;
}
};

for (let j = 0; j < keyNum; j++) {

const posj = g_keyObj[`pos${keyCtrlPtn}`][j];
Expand Down Expand Up @@ -5385,9 +5403,10 @@ function keyConfigInit(_kcType = g_kcType) {
);
if (g_headerObj.shuffleUse && g_keyObj[`shuffle${keyCtrlPtn}`] !== undefined) {
keyconSprite.appendChild(
createDivCss2Label(`sArrow${j}`, ``, {
x: keyconX, y: keyconY - 12, w: C_ARW_WIDTH, h: 15, siz: 12, align: C_ALIGN_CENTER, fontWeight: `bold`,
})
createCss2Button(`sArrow${j}`, ``, _ => changeTmpShuffleNum(j), {
x: keyconX, y: keyconY - 12, w: C_ARW_WIDTH, h: 15, siz: 12, fontWeight: `bold`,
cxtFunc: _ => changeTmpShuffleNum(j, -1),
}, g_cssObj.button_Default_NoColor, g_cssObj.title_base)
);
}

Expand Down

0 comments on commit 7cd8e75

Please sign in to comment.