From d1953ad3b2ce2ef1e6282c800a10f41a81f24dfe Mon Sep 17 00:00:00 2001 From: tickle Date: Thu, 7 Jan 2021 07:14:15 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[0327/deprecated-func:0.1.0]=20=E9=9D=9E?= =?UTF-8?q?=E6=8E=A8=E5=A5=A8=E9=96=A2=E6=95=B0=E3=82=92legacy=5Ffunction?= =?UTF-8?q?=E3=81=B8=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/danoni_main.js | 88 ------------------------------- js/lib/danoni_legacy_function.js | 89 ++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 88 deletions(-) diff --git a/js/danoni_main.js b/js/danoni_main.js index 23750b33..763d2674 100644 --- a/js/danoni_main.js +++ b/js/danoni_main.js @@ -527,30 +527,6 @@ function createDiv(_id, _x, _y, _width, _height) { return div; } -/** - * 子div要素のラベル文字作成 (CSS版) - * @param {string} _id - * @param {number} _x - * @param {number} _y - * @param {number} _width - * @param {number} _height - * @param {number} _fontsize - * @param {string} _text - * @param {string} _class - */ -function createDivCssLabel(_id, _x, _y, _width, _height, _fontsize, _text, _class = g_cssObj.title_base) { - const div = createDiv(_id, _x, _y, _width, _height); - div.classList.add(_class); - - const style = div.style; - style.fontSize = `${_fontsize}px`; - style.fontFamily = getBasicFont(); - style.textAlign = C_ALIGN_CENTER; - div.innerHTML = _text; - - return div; -} - /** * 子div要素のラベル文字作成 * - createDivLabelに加えて、独自フォントが指定できる形式。 @@ -739,70 +715,6 @@ function deleteChildspriteAll(_parentObjName) { } } -/** - * ボタンの作成 (CSS版) - * - ボタンの位置、色といった基本設定をここで指定 - * - 実際のボタンは以下のように設定して使用すること(表示されなくなる) - * - ボタンの表示テキスト及びフォントは固定 - * - * - 使い方: - * const btnBack = createButton({ - * // ボタンオブジェクト名 - * id: `btnBack`, - * // ボタンに表示する名前 - * name: `Back`, - * // 作成先のx座標 (appendChildする親に対する位置) - * x: 0, - * // 作成先のy座標 (appendChildする親に対する位置) - * y: g_sHeight-100, - * // 幅 - * width: g_sWidth/3, - * // 高さ - * height: C_BTN_HEIGHT, - * // フォントサイズ - * fontsize: C_LBL_BTNSIZE, - * // 表示位置 - * align: C_ALIGN_CENTER, - * // CSSクラス名 - * class: `class_name`, - * }, _ => { - * // ボタン押下後の処理 - * clearWindow(); - * titleInit(); - * }); - * divRoot.appendChild(btnBack); - * - * @param {object} _obj ボタンオブジェクト - * @param {function} _func ボタン押下後の処理(マウスハンドラ) - */ -function createCssButton(_obj, _func) { - - // ボタン用の子要素divを作成 - const div = createDiv(_obj.id, _obj.x, _obj.y, _obj.width, _obj.height); - div.classList.add(`button_common`, _obj.class); - - // ボタンの装飾を定義 - const style = div.style; - div.innerHTML = _obj.name; - style.textAlign = _obj.align; - style.verticalAlign = C_VALIGN_MIDDLE; - style.fontSize = `${_obj.fontsize}px`; - style.fontFamily = getBasicFont(); - if (hasVal(_obj.animationName)) { - style.animationName = _obj.animationName; - style.animationDuration = `1s`; - } - div.ontouchstart = ``; - - // ボタンを押したときの動作 - const lsnrkey = g_handler.addListener(div, `click`, _ => _func()); - - // イベントリスナー用のキーをセット - div.setAttribute(`lsnrkey`, lsnrkey); - - return div; -} - /** * ボタンの作成 (CSS版・拡張属性対応) * @param {string} _id diff --git a/js/lib/danoni_legacy_function.js b/js/lib/danoni_legacy_function.js index 61d06044..9315cc63 100644 --- a/js/lib/danoni_legacy_function.js +++ b/js/lib/danoni_legacy_function.js @@ -70,6 +70,31 @@ function createDivLabel(_id, _x, _y, _width, _height, _fontsize, _color, _text) return div; } + +/** + * 子div要素のラベル文字作成 (CSS版, v15互換用) + * @param {string} _id + * @param {number} _x + * @param {number} _y + * @param {number} _width + * @param {number} _height + * @param {number} _fontsize + * @param {string} _text + * @param {string} _class + */ +function createDivCssLabel(_id, _x, _y, _width, _height, _fontsize, _text, _class = g_cssObj.title_base) { + const div = createDiv(_id, _x, _y, _width, _height); + div.classList.add(_class); + + const style = div.style; + style.fontSize = `${_fontsize}px`; + style.fontFamily = getBasicFont(); + style.textAlign = C_ALIGN_CENTER; + div.innerHTML = _text; + + return div; +} + /** * 矢印オブジェクトの作成(色付きマスク版)- v10以降は未使用 * @param {string} _id @@ -198,6 +223,70 @@ function createButton(_obj, _func) { return div; } +/** + * ボタンの作成 (CSS版, v15互換版) + * - ボタンの位置、色といった基本設定をここで指定 + * - 実際のボタンは以下のように設定して使用すること(表示されなくなる) + * - ボタンの表示テキスト及びフォントは固定 + * + * - 使い方: + * const btnBack = createButton({ + * // ボタンオブジェクト名 + * id: `btnBack`, + * // ボタンに表示する名前 + * name: `Back`, + * // 作成先のx座標 (appendChildする親に対する位置) + * x: 0, + * // 作成先のy座標 (appendChildする親に対する位置) + * y: g_sHeight-100, + * // 幅 + * width: g_sWidth/3, + * // 高さ + * height: C_BTN_HEIGHT, + * // フォントサイズ + * fontsize: C_LBL_BTNSIZE, + * // 表示位置 + * align: C_ALIGN_CENTER, + * // CSSクラス名 + * class: `class_name`, + * }, _ => { + * // ボタン押下後の処理 + * clearWindow(); + * titleInit(); + * }); + * divRoot.appendChild(btnBack); + * + * @param {object} _obj ボタンオブジェクト + * @param {function} _func ボタン押下後の処理(マウスハンドラ) + */ +function createCssButton(_obj, _func) { + + // ボタン用の子要素divを作成 + const div = createDiv(_obj.id, _obj.x, _obj.y, _obj.width, _obj.height); + div.classList.add(`button_common`, _obj.class); + + // ボタンの装飾を定義 + const style = div.style; + div.innerHTML = _obj.name; + style.textAlign = _obj.align; + style.verticalAlign = C_VALIGN_MIDDLE; + style.fontSize = `${_obj.fontsize}px`; + style.fontFamily = getBasicFont(); + if (hasVal(_obj.animationName)) { + style.animationName = _obj.animationName; + style.animationDuration = `1s`; + } + div.ontouchstart = ``; + + // ボタンを押したときの動作 + const lsnrkey = g_handler.addListener(div, `click`, _ => _func()); + + // イベントリスナー用のキーをセット + div.setAttribute(`lsnrkey`, lsnrkey); + + return div; +} + /** * 設定・オプション表示用ボタン - v9互換用 * @param {string} _id From dca70a273d5e394f89c49bf8413f721e21cad886 Mon Sep 17 00:00:00 2001 From: tickle Date: Thu, 7 Jan 2021 07:18:53 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[0327/deprecated-func:0.2.0]=20createColorO?= =?UTF-8?q?bject=E3=82=92legacy=5Ffunction=E3=81=B8=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/danoni_main.js | 38 ----------------------------- js/lib/danoni_legacy_function.js | 42 ++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/js/danoni_main.js b/js/danoni_main.js index 763d2674..ca905137 100644 --- a/js/danoni_main.js +++ b/js/danoni_main.js @@ -592,44 +592,6 @@ function createImg(_id, _imgPath, _x, _y, _width, _height) { return div; } -/** - * 色付きオブジェクトの作成 - * @param {string} _id - * @param {string} _color - * @param {number} _x - * @param {number} _y - * @param {number} _width - * @param {number} _height - * @param {string} _rotate オブジェクト名/回転角度 (default : ``) - * @param {string} _styleName オブジェクト種類 (default : ``) - */ -function createColorObject(_id, _color, _x, _y, _width, _height, - _rotate = ``, _styleName = ``) { - - const div = createDiv(_id, _x, _y, _width, _height); - - // 矢印・オブジェクト判定 - let charaStyle; - if (isNaN(Number(_rotate)) || _rotate === ``) { - charaStyle = `${_rotate}${_styleName}`; - } else { - charaStyle = `arrow${_styleName}`; - div.style.transform = `rotate(${_rotate}deg)`; - } - - if (_color !== ``) { - div.style.background = _color; - } - div.style.maskImage = `url("${g_imgObj[charaStyle]}")`; - div.style.maskSize = `contain`; - div.style.webkitMaskImage = `url("${g_imgObj[charaStyle]}")`; - div.style.webkitMaskSize = `contain`; - div.setAttribute(`color`, _color); - div.setAttribute(`type`, charaStyle); - - return div; -} - /** * 色付きオブジェクトの作成 (拡張属性対応) * @param {string} _id diff --git a/js/lib/danoni_legacy_function.js b/js/lib/danoni_legacy_function.js index 9315cc63..1f25acff 100644 --- a/js/lib/danoni_legacy_function.js +++ b/js/lib/danoni_legacy_function.js @@ -72,7 +72,7 @@ function createDivLabel(_id, _x, _y, _width, _height, _fontsize, _color, _text) /** - * 子div要素のラベル文字作成 (CSS版, v15互換用) + * 子div要素のラベル文字作成 (CSS版, v16互換) * @param {string} _id * @param {number} _x * @param {number} _y @@ -131,6 +131,44 @@ function createArrowEffect(_id, _color, _x, _y, _size, _rotate) { return div; } +/** + * 色付きオブジェクトの作成 (v16互換) + * @param {string} _id + * @param {string} _color + * @param {number} _x + * @param {number} _y + * @param {number} _width + * @param {number} _height + * @param {string} _rotate オブジェクト名/回転角度 (default : ``) + * @param {string} _styleName オブジェクト種類 (default : ``) + */ +function createColorObject(_id, _color, _x, _y, _width, _height, + _rotate = ``, _styleName = ``) { + + const div = createDiv(_id, _x, _y, _width, _height); + + // 矢印・オブジェクト判定 + let charaStyle; + if (isNaN(Number(_rotate)) || _rotate === ``) { + charaStyle = `${_rotate}${_styleName}`; + } else { + charaStyle = `arrow${_styleName}`; + div.style.transform = `rotate(${_rotate}deg)`; + } + + if (_color !== ``) { + div.style.background = _color; + } + div.style.maskImage = `url("${g_imgObj[charaStyle]}")`; + div.style.maskSize = `contain`; + div.style.webkitMaskImage = `url("${g_imgObj[charaStyle]}")`; + div.style.webkitMaskSize = `contain`; + div.setAttribute(`color`, _color); + div.setAttribute(`type`, charaStyle); + + return div; +} + /** * ボタンの作成 (v9互換版) * - ボタンの位置、色といった基本設定をここで指定 @@ -224,7 +262,7 @@ function createButton(_obj, _func) { } /** - * ボタンの作成 (CSS版, v15互換版) + * ボタンの作成 (CSS版, v16互換) * - ボタンの位置、色といった基本設定をここで指定 * - 実際のボタンは以下のように設定して使用すること(表示されなくなる) * - ボタンの表示テキスト及びフォントは固定