danoniplus 42.1.1 → 42.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/js/danoni_main.js +22 -9
  2. package/package.json +1 -1
package/js/danoni_main.js CHANGED
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 42.1.1`;
11
+ const g_version = `Ver 42.1.2`;
12
12
  const g_revisedDate = `2025/06/08`;
13
13
 
14
14
  // カスタム用バージョン (danoni_custom.js 等で指定可)
@@ -1206,6 +1206,7 @@ const reviseCssText = _str => {
1206
1206
  /*-----------------------------------------------------------*/
1207
1207
  /* 色・グラデーション設定 */
1208
1208
  /*-----------------------------------------------------------*/
1209
+ const g_ctx = document.createElement(`canvas`).getContext(`2d`);
1209
1210
 
1210
1211
  /**
1211
1212
  * 対象のカラーコードが明暗どちらかを判定 (true: 明色, false: 暗色)
@@ -1225,9 +1226,8 @@ const checkLightOrDark = _colorStr => {
1225
1226
  * @returns {string}
1226
1227
  */
1227
1228
  const colorNameToCode = _color => {
1228
- const cxt = document.createElement(`canvas`).getContext(`2d`);
1229
- cxt.fillStyle = _color;
1230
- return cxt.fillStyle;
1229
+ g_ctx.fillStyle = _color;
1230
+ return g_ctx.fillStyle;
1231
1231
  };
1232
1232
 
1233
1233
  /**
@@ -1365,11 +1365,24 @@ const getBasicFont = (_priorityFont = ``) =>
1365
1365
  * @returns {number}
1366
1366
  */
1367
1367
  const getStrWidth = (_str, _fontsize, _font) => {
1368
- const ctx = document.createElement(`canvas`).getContext(`2d`);
1369
- ctx.font = `${wUnit(_fontsize)} ${_font}`;
1370
- return ctx.measureText(unEscapeHtml(_str)).width;
1368
+ g_ctx.font = `${wUnit(_fontsize)} ${_font}`;
1369
+ return g_ctx.measureText(unEscapeHtml(_str)).width;
1371
1370
  };
1372
1371
 
1372
+ /**
1373
+ * Canvas上で使用する絵文字を取得
1374
+ * - HTMLのdiv要素に絵文字を設定することで、Canvas上で使用できるようにする
1375
+ * @param {string} _str
1376
+ * @returns {string}
1377
+ */
1378
+ const getEmojiForCanvas = _str => {
1379
+ const div = document.createElement(`div`);
1380
+ div.innerHTML = _str;
1381
+ const result = div.innerHTML;
1382
+ div.remove();
1383
+ return result;
1384
+ }
1385
+
1373
1386
  /**
1374
1387
  * 指定した横幅に合ったフォントサイズを取得
1375
1388
  * @param {string} _str
@@ -13994,7 +14007,7 @@ const resultInit = () => {
13994
14007
  { x: 280, dy: -15, hy: 0, siz: 20, color: `#999999`, align: C_ALIGN_CENTER });
13995
14008
  drawText(unEscapeHtml(mTitleForView[0]), { hy: 1 });
13996
14009
  drawText(unEscapeHtml(mTitleForView[1]), { hy: 2 });
13997
- drawText(`📝 ${unEscapeHtml(g_headerObj.tuning)} / 🎵 ${unEscapeHtml(artistName)}`, { hy: mTitleForView[1] !== `` ? 3 : 2, siz: 12 });
14010
+ drawText(`${getEmojiForCanvas(`📝`)} ${unEscapeHtml(g_headerObj.tuning)} / ${getEmojiForCanvas(`🎵`)} ${unEscapeHtml(artistName)}`, { hy: mTitleForView[1] !== `` ? 3 : 2, siz: 12 });
13998
14011
  drawText(unEscapeHtml(difDataForImage), { hy: 4 });
13999
14012
 
14000
14013
  if (playStyleData.length > 60) {
@@ -14135,7 +14148,7 @@ const resultInit = () => {
14135
14148
  // リトライ
14136
14149
  resetCommonBtn(`btnRetry`, g_lblNameObj.b_retry, g_lblPosObj.btnRsRetry, loadMusic, g_cssObj.button_Reset),
14137
14150
 
14138
- createCss2Button(`btnCopyImage`, `📷`, () => true,
14151
+ createCss2Button(`btnCopyImage`, `📷`, () => true,
14139
14152
  Object.assign(g_lblPosObj.btnRsCopyImage, {
14140
14153
  resetFunc: () => copyResultImageData(g_msgInfoObj.I_0001),
14141
14154
  }), g_cssObj.button_Default_NoColor),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "42.1.1",
3
+ "version": "42.1.2",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "./js/danoni_main.js",
6
6
  "scripts": {