Skip to content

Commit 28fce33

Browse files
committed
tegaki更新。Spaceキー押下で手のひらツール。
1 parent 76a3fbb commit 28fce33

2 files changed

Lines changed: 42 additions & 15 deletions

File tree

petitnote/app/tegaki/tegaki.js

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,6 +2482,15 @@ var TegakiKeybinds = {
24822482
},
24832483

24842484
resolve: function (e) {
2485+
if (e.key === " ") {
2486+
Tegaki.isPressedSpaceKey = true;
2487+
const cursor_layer = document.getElementById("tegaki-cursor-layer");
2488+
if (cursor_layer) {
2489+
cursor_layer.style.pointerEvents = "none";
2490+
cursor_layer.style.touchAction = "auto";
2491+
}
2492+
}
2493+
24852494
var fn, mods, keys, el;
24862495

24872496
el = e.target;
@@ -2505,6 +2514,12 @@ var TegakiKeybinds = {
25052514

25062515
keys = e.key.toLowerCase();
25072516

2517+
//ブラウザデフォルトのキー操作をキャンセル
2518+
const arrkeys = ["+", ";", "=", "-", "s", "h", "r", "o"];
2519+
if (arrkeys.includes(keys)) {
2520+
e.preventDefault();
2521+
}
2522+
25082523
if (mods[0]) {
25092524
keys = mods.join("+") + "+" + keys;
25102525
}
@@ -2516,20 +2531,19 @@ var TegakiKeybinds = {
25162531
e.stopPropagation();
25172532
fn[0][fn[1]]();
25182533
}
2519-
document.addEventListener("keyup", function (e) {
2520-
// e.key を利用して特定のキーのアップイベントを検知する
2521-
if (e.key.toLowerCase() === "alt") {
2522-
e.preventDefault(); // Alt キーのデフォルトの動作をキャンセル
2523-
}
2524-
});
2525-
//ブラウザデフォルトのキー操作をキャンセル
2526-
document.addEventListener("keydown", (e) => {
2527-
const keys = ["+", ";", "=", "-", "s", "h", "r", "o"];
2528-
if (keys.includes(e.key.toLowerCase())) {
2529-
// console.log("e.key",e.key);
2530-
e.preventDefault();
2534+
},
2535+
onKeyUp: function (e) {
2536+
if (e.key === " ") {
2537+
Tegaki.isPressedSpaceKey = false;
2538+
const cursor_layer = document.getElementById("tegaki-cursor-layer");
2539+
if (cursor_layer) {
2540+
cursor_layer.style.pointerEvents = "auto";
2541+
cursor_layer.style.touchAction = "none";
25312542
}
2532-
});
2543+
}
2544+
if (e.key.toLowerCase() === "alt") {
2545+
e.preventDefault(); // Alt キーのデフォルトの動作をキャンセル
2546+
}
25332547
},
25342548
};
25352549
var TegakiLayers = {
@@ -3061,6 +3075,8 @@ var Tegaki = {
30613075
activePointerId: 0,
30623076
activePointerIsPen: false,
30633077

3078+
isPressedSpaceKey: false,
3079+
30643080
isPainting: false,
30653081

30663082
offsetX: 0,
@@ -3305,6 +3321,7 @@ var Tegaki = {
33053321
$T.on(document, "pointercancel", self.onPointerUp);
33063322

33073323
$T.on(document, "keydown", TegakiKeybinds.resolve);
3324+
$T.on(document, "keyup", TegakiKeybinds.onKeyUp);
33083325

33093326
$T.on(window, "beforeunload", Tegaki.onTabClose);
33103327
} else {
@@ -3329,6 +3346,7 @@ var Tegaki = {
33293346
$T.off(document, "pointercancel", self.onPointerUp);
33303347

33313348
$T.off(document, "keydown", TegakiKeybinds.resolve);
3349+
$T.off(document, "keyup", TegakiKeybinds.onKeyUp);
33323350

33333351
$T.off(window, "beforeunload", Tegaki.onTabClose);
33343352
} else {
@@ -4384,6 +4402,9 @@ var Tegaki = {
43844402
if (Tegaki.cursor) {
43854403
TegakiCursor.render(e.clientX, e.clientY);
43864404
}
4405+
if (Tegaki.isPressedSpaceKey) {
4406+
return;
4407+
}
43874408

43884409
if (e.mozInputSource !== undefined) {
43894410
// Firefox thing where mouse events fire for no reason when the pointer is a pen
@@ -4440,6 +4461,12 @@ var Tegaki = {
44404461
if (Tegaki.cursor) {
44414462
TegakiCursor.render(e.clientX, e.clientY);
44424463
}
4464+
if (Tegaki.isPressedSpaceKey) {
4465+
if (e.target.releasePointerCapture) {
4466+
e.target.releasePointerCapture(e.pointerId);
4467+
}
4468+
return;
4469+
}
44434470

44444471
if (Tegaki.isScrollbarClick(e)) {
44454472
return;

petitnote/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
//https://paintbbs.sakura.ne.jp/
44
//1スレッド1ログファイル形式のスレッド式画像掲示板
55

6-
$petit_ver='v1.212.5';
7-
$petit_lot='lot.20260420.1';
6+
$petit_ver='v1.213.1';
7+
$petit_lot='lot.20260421.5';
88

99
$lang = ($http_langs = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? '')
1010
? explode( ',', $http_langs )[0] : '';

0 commit comments

Comments
 (0)