Skip to content

Commit f0dc023

Browse files
committed
NEOv1.6.38に更新。スマホ描画時にもPointerUp時の処理を正しく行えるようにした。
1 parent c185c34 commit f0dc023

2 files changed

Lines changed: 101 additions & 67 deletions

File tree

petitnote/app/neo/neo.js

Lines changed: 95 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ document.addEventListener("DOMContentLoaded", function () {
1010

1111
var Neo = function () {};
1212

13-
Neo.version = "1.6.36";
13+
Neo.version = "1.6.38";
1414
Neo.painter = null;
1515
Neo.fullScreen = false;
1616
Neo.uploaded = false;
@@ -21,9 +21,18 @@ Neo.canvas = null;
2121
Neo.toolsWrapper = null;
2222
Neo.toolSide = false;
2323
Neo.applet = null;
24-
Neo.animation = null;
24+
Neo.isAnimation = false;
2525
Neo.storage = null;
2626
Neo.elementNeo = null;
27+
Neo.getPCH = null;
28+
Neo.getFilename = null;
29+
Neo.createViewer = null;
30+
Neo.createViewer = null;
31+
Neo.initViewer = null;
32+
Neo.isPinchZooming = null;
33+
Neo.touch_move_grid_control = function () {};
34+
Neo.add_touch_move_grid_control = function () {};
35+
Neo.updateUI = function () {};
2736
Neo.translate = function (str) {
2837
return str;
2938
};
@@ -130,7 +139,7 @@ Neo.init2 = function () {
130139
};
131140

132141
// 動画記録
133-
Neo.animation = Neo.config.thumbnail_type == "animation";
142+
Neo.isAnimation = Neo.config.thumbnail_type == "animation";
134143

135144
// 続きから描く
136145
Neo.storage = localStorage; //PCの時にもlocalStorageを使用
@@ -1866,8 +1875,8 @@ Neo.Painter = function () {
18661875
Neo.Painter.prototype.container = null;
18671876
Neo.Painter.prototype._undoMgr;
18681877
Neo.Painter.prototype._actionMgr;
1869-
Neo.Painter.prototype.tool;
1870-
Neo.Painter.prototype.inputText;
1878+
Neo.Painter.prototype.tool = null;
1879+
Neo.Painter.prototype.inputText = null;
18711880

18721881
//Canvas Info
18731882
Neo.Painter.prototype.canvas = [];
@@ -1876,14 +1885,15 @@ Neo.Painter.prototype.visible = [];
18761885
Neo.Painter.prototype.current = 0;
18771886

18781887
//Temp Canvas Info
1879-
Neo.Painter.prototype.tempCanvas;
1880-
Neo.Painter.prototype.tempCanvasCtx;
1888+
Neo.Painter.prototype.tempCanvas = null;
1889+
Neo.Painter.prototype.tempCanvasCtx = null;
18811890
Neo.Painter.prototype.tempX = 0;
18821891
Neo.Painter.prototype.tempY = 0;
1892+
Neo.Painter.prototype.temp = null;
18831893

18841894
//Destination Canvas for display
1885-
Neo.Painter.prototype.destCanvas;
1886-
Neo.Painter.prototype.destCanvasCtx;
1895+
Neo.Painter.prototype.destCanvas = null;
1896+
Neo.Painter.prototype.destCanvasCtx = null;
18871897

18881898
Neo.Painter.prototype.backgroundColor = "#ffffff";
18891899
Neo.Painter.prototype.foregroundColor = "#000000";
@@ -1897,7 +1907,6 @@ Neo.Painter.prototype.zoomY = 0;
18971907
Neo.Painter.prototype.isMouseDown = false;
18981908
Neo.Painter.prototype.isMouseDownRight = false;
18991909
Neo.Painter.prototype.isSpaceDown = false;
1900-
Neo.Painter.prototype.inputText = null;
19011910

19021911
Neo.Painter.prototype.isBezierActive = false;
19031912
Neo.Painter.prototype.isCopyActive = false;
@@ -1906,6 +1915,8 @@ Neo.Painter.prototype.prevMouseX = null;
19061915
Neo.Painter.prototype.prevMouseY = null;
19071916
Neo.Painter.prototype.mouseX = null;
19081917
Neo.Painter.prototype.mouseY = null;
1918+
Neo.Painter.prototype.rawMouseX = null;
1919+
Neo.Painter.prototype.rawMouseY = null;
19091920

19101921
Neo.Painter.prototype.stabilizedX = null;
19111922
Neo.Painter.prototype.stabilizedY = null;
@@ -1922,6 +1933,8 @@ Neo.Painter.prototype.destHeight = 0;
19221933
Neo.Painter.prototype.canvasWidth = 0;
19231934
Neo.Painter.prototype.canvasHeight = 0;
19241935

1936+
Neo.Painter.prototype._currentWidth = null;
1937+
Neo.Painter.prototype._currentMaskType = 0;
19251938
//Neo.Painter.prototype.slowX = 0;
19261939
//Neo.Painter.prototype.slowY = 0;
19271940
//Neo.Painter.prototype.stab = null;
@@ -1945,7 +1958,7 @@ Neo.Painter.prototype.maskColor = "#000000";
19451958
Neo.Painter.prototype._currentColor = [];
19461959
Neo.Painter.prototype._currentMask = [];
19471960

1948-
Neo.Painter.prototype.aerr;
1961+
Neo.Painter.prototype.aerr = 0;
19491962
Neo.Painter.prototype.dirty = false;
19501963
Neo.Painter.prototype.busy = false;
19511964
Neo.Painter.prototype.busySkipped = false;
@@ -2421,8 +2434,8 @@ Neo.Painter.prototype._keyDownHandler = function (e) {
24212434
if (document.activeElement != this.inputText) {
24222435
if (
24232436
!(
2424-
document.activeElement.tagName.toLocaleUpperCase() === "INPUT" ||
2425-
document.activeElement.tagName.toLocaleUpperCase() === "TEXTAREA"
2437+
document.activeElement?.tagName.toLocaleUpperCase() === "INPUT" ||
2438+
document.activeElement?.tagName.toLocaleUpperCase() === "TEXTAREA"
24262439
)
24272440
) {
24282441
e.preventDefault();
@@ -2560,6 +2573,8 @@ Neo.Painter.prototype._mouseUpHandler = function (e) {
25602573
Neo.RightButton.clear();
25612574
}
25622575

2576+
this._updateMousePosition(e);
2577+
25632578
// if (e.changedTouches) {
25642579
// for (var i = 0; i < e.changedTouches.length; i++) {
25652580
// var touch = e.changedTouches[i];
@@ -2573,35 +2588,6 @@ Neo.Painter.prototype._mouseUpHandler = function (e) {
25732588
Neo.Painter.prototype._mouseMoveHandler = function (e) {
25742589
this._updateMousePosition(e);
25752590

2576-
// 指数移動平均による手ブレ補正
2577-
if (
2578-
Neo.config.neo_disable_stabilizer != "true" &&
2579-
e.type != "touchmove" &&
2580-
this.isMouseDown
2581-
) {
2582-
// 0.0〜0.99 0.0で補正なし
2583-
const stability = 0.8;
2584-
const factor = 1.0 - stability;
2585-
2586-
// moothXが未定義なら現在の位置で初期化
2587-
if (typeof this.stabilizedX !== "number" || isNaN(this.stabilizedX)) {
2588-
this.stabilizedX = this.mouseX;
2589-
this.stabilizedY = this.mouseY;
2590-
} else {
2591-
//補間計算
2592-
this.stabilizedX = factor * this.mouseX + stability * this.stabilizedX;
2593-
this.stabilizedY = factor * this.mouseY + stability * this.stabilizedY;
2594-
}
2595-
2596-
// 手ブレ補正後の数値に差し替え
2597-
this.mouseX = this.stabilizedX;
2598-
this.mouseY = this.stabilizedY;
2599-
} else {
2600-
// マウスを離している時はリセット
2601-
this.stabilizedX = null;
2602-
this.stabilizedY = null;
2603-
}
2604-
26052591
if (e.type == "touchmove" && e.touches.length > 1) return;
26062592

26072593
if (this.isMouseDown || this.isMouseDownRight) {
@@ -2640,6 +2626,38 @@ Neo.Painter.prototype.getPosition = function (e) {
26402626
}
26412627
};
26422628

2629+
// 手ぶれ補正
2630+
Neo.Painter.prototype._stabilizer = function (e) {
2631+
const rawX = this.mouseX;
2632+
const rawY = this.mouseY;
2633+
const freeHandMode = this.drawType === 0;
2634+
if (Neo.config.neo_disable_stabilizer != "true" && freeHandMode) {
2635+
if (this.isMouseDown) {
2636+
// 0.0〜0.99 最大
2637+
const stability = 0.8;
2638+
const factor = 1.0 - stability;
2639+
2640+
// moothXが未定義なら現在の位置で初期化
2641+
if (typeof this.stabilizedX !== "number" || isNaN(this.stabilizedX)) {
2642+
this.stabilizedX = this.mouseX;
2643+
this.stabilizedY = this.mouseY;
2644+
} else {
2645+
this.stabilizedX = factor * this.mouseX + stability * this.stabilizedX;
2646+
this.stabilizedY = factor * this.mouseY + stability * this.stabilizedY;
2647+
}
2648+
// 手ブレ補正後の数値に差し替え
2649+
this.mouseX = this.stabilizedX;
2650+
this.mouseY = this.stabilizedY;
2651+
} else {
2652+
// マウスを離している時はリセット
2653+
this.stabilizedX = null;
2654+
this.stabilizedY = null;
2655+
this.mouseX = rawX;
2656+
this.mouseY = rawY;
2657+
}
2658+
}
2659+
};
2660+
26432661
Neo.Painter.prototype._updateMousePosition = function (e) {
26442662
var rect = this.destCanvas.getBoundingClientRect();
26452663
// var x = (e.clientX !== undefined) ? e.clientX : e.touches[0].clientX;
@@ -2666,6 +2684,9 @@ Neo.Painter.prototype._updateMousePosition = function (e) {
26662684
this.prevMouseY = this.mouseY;
26672685
}
26682686

2687+
//手ぶれ補正
2688+
this._stabilizer(e);
2689+
26692690
/*
26702691
this.slowX = this.slowX * 0.8 + this.mouseX * 0.2;
26712692
this.slowY = this.slowY * 0.8 + this.mouseY * 0.2;
@@ -2901,7 +2922,7 @@ Neo.Painter.prototype.setZoomPosition = function (x, y) {
29012922
*/
29022923

29032924
Neo.Painter.prototype.submit = function (board) {
2904-
if (Neo.animation) {
2925+
if (Neo.isAnimation) {
29052926
// neo_save_layers
29062927
var items = this._actionMgr._items;
29072928
if (items.length > 0 && items[items.length - 1][0] != "restore") {
@@ -3396,12 +3417,15 @@ Neo.Painter.prototype.setPenPoint = function (buf8, width, x, y) {
33963417
var a0 = buf8[index + 3] / 255.0;
33973418

33983419
var a = a0 + a1 - a0 * a1;
3420+
let r = r0,
3421+
g = g0,
3422+
b = b0;
33993423
if (a > 0) {
34003424
var a1x = Math.max(a1, 1.0 / 255);
34013425

3402-
var r = (r1 * a1x + r0 * a0 * (1 - a1x)) / a;
3403-
var g = (g1 * a1x + g0 * a0 * (1 - a1x)) / a;
3404-
var b = (b1 * a1x + b0 * a0 * (1 - a1x)) / a;
3426+
r = (r1 * a1x + r0 * a0 * (1 - a1x)) / a;
3427+
g = (g1 * a1x + g0 * a0 * (1 - a1x)) / a;
3428+
b = (b1 * a1x + b0 * a0 * (1 - a1x)) / a;
34053429

34063430
r = r1 > r0 ? Math.ceil(r) : Math.floor(r);
34073431
g = g1 > g0 ? Math.ceil(g) : Math.floor(g);
@@ -3423,8 +3447,8 @@ Neo.Painter.prototype.setPenPoint = function (buf8, width, x, y) {
34233447
};
34243448

34253449
Neo.Painter.prototype.setBrushPoint = function (buf8, width, x, y) {
3426-
var d = this._currentWidth;
3427-
var r0 = Math.floor(d / 2);
3450+
const d = this._currentWidth;
3451+
let r0 = Math.floor(d / 2);
34283452
x -= r0;
34293453
y -= r0;
34303454

@@ -3442,18 +3466,21 @@ Neo.Painter.prototype.setBrushPoint = function (buf8, width, x, y) {
34423466
for (var i = 0; i < d; i++) {
34433467
for (var j = 0; j < d; j++) {
34443468
if (shape[shapeIndex++] && !this.isMasked(buf8, index)) {
3445-
var r0 = buf8[index + 0];
3446-
var g0 = buf8[index + 1];
3447-
var b0 = buf8[index + 2];
3448-
var a0 = buf8[index + 3] / 255.0;
3449-
3450-
var a = a0 + a1 - a0 * a1;
3469+
let r0 = buf8[index + 0];
3470+
let g0 = buf8[index + 1];
3471+
let b0 = buf8[index + 2];
3472+
let a0 = buf8[index + 3] / 255.0;
3473+
3474+
let a = a0 + a1 - a0 * a1;
3475+
let r = r0,
3476+
g = g0,
3477+
b = b0;
34513478
if (a > 0) {
3452-
var a1x = Math.max(a1, 1.0 / 255);
3479+
let a1x = Math.max(a1, 1.0 / 255);
34533480

3454-
var r = (r1 * a1x + r0 * a0) / (a0 + a1x);
3455-
var g = (g1 * a1x + g0 * a0) / (a0 + a1x);
3456-
var b = (b1 * a1x + b0 * a0) / (a0 + a1x);
3481+
r = (r1 * a1x + r0 * a0) / (a0 + a1x);
3482+
g = (g1 * a1x + g0 * a0) / (a0 + a1x);
3483+
b = (b1 * a1x + b0 * a0) / (a0 + a1x);
34573484

34583485
r = r1 > r0 ? Math.ceil(r) : Math.floor(r);
34593486
g = g1 > g0 ? Math.ceil(g) : Math.floor(g);
@@ -4355,6 +4382,9 @@ Neo.Painter.prototype.doFloodFill = function (layer, x, y, fillColor) {
43554382
break;
43564383
}
43574384
var point = stack.pop();
4385+
if (!point) {
4386+
break;
4387+
}
43584388
var x = point.x;
43594389
var y = point.y;
43604390
var x0 = x;
@@ -5194,7 +5224,7 @@ Neo.DrawToolBase.prototype.freeHandUpMoveHandler = function (oe) {
51945224
oe.updateDestCanvas(rect[0], rect[1], rect[2], rect[3], true);
51955225
oe.cursorRect = null;
51965226
}
5197-
//縮小時は浮動円カーソルを非表示 部分更新のグリッチが出るため
5227+
//縮小時は円カーソルを非表示 部分更新のグリッチが出るため
51985228
if (oe.zoom < 1) {
51995229
return;
52005230
}
@@ -6518,7 +6548,7 @@ Neo.ActionManager.prototype.speedMode = function () {
65186548
};
65196549

65206550
Neo.ActionManager.prototype.step = function () {
6521-
if (!Neo.animation) return;
6551+
if (!Neo.isAnimation) return;
65226552

65236553
if (this._items.length > this._head) {
65246554
this._items.length = this._head;
@@ -6529,23 +6559,23 @@ Neo.ActionManager.prototype.step = function () {
65296559
};
65306560

65316561
Neo.ActionManager.prototype.back = function () {
6532-
if (!Neo.animation) return;
6562+
if (!Neo.isAnimation) return;
65336563

65346564
if (this._head > 0) {
65356565
this._head--;
65366566
}
65376567
};
65386568

65396569
Neo.ActionManager.prototype.forward = function () {
6540-
if (!Neo.animation) return;
6570+
if (!Neo.isAnimation) return;
65416571

65426572
if (this._head < this._items.length) {
65436573
this._head++;
65446574
}
65456575
};
65466576

65476577
Neo.ActionManager.prototype.push = function () {
6548-
if (!Neo.animation) return;
6578+
if (!Neo.isAnimation) return;
65496579

65506580
var head = this._items[this._head - 1];
65516581
for (var i = 0; i < arguments.length; i++) {
@@ -6554,7 +6584,7 @@ Neo.ActionManager.prototype.push = function () {
65546584
};
65556585

65566586
Neo.ActionManager.prototype.pushCurrent = function () {
6557-
if (!Neo.animation) return;
6587+
if (!Neo.isAnimation) return;
65586588

65596589
var oe = Neo.painter;
65606590
var head = this._items[this._head - 1];
@@ -6814,7 +6844,7 @@ Neo.ActionManager.prototype.freeHandMove = function (x0, y0, x1, y1, lineType) {
68146844
this.push("freeHand", layer);
68156845
this.pushCurrent();
68166846
this.push(lineType, x1, y1, x0, y0);
6817-
} else if (Neo.animation) {
6847+
} else if (Neo.isAnimation) {
68186848
head.push(x0, y0);
68196849

68206850
// 記録漏れがないか確認

petitnote/index.php

Lines changed: 6 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.209.2';
7-
$petit_lot='lot.20260417';
6+
$petit_ver='v1.211.1';
7+
$petit_lot='lot.20260418.2';
88

99
$lang = ($http_langs = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? '')
1010
? explode( ',', $http_langs )[0] : '';
@@ -2710,6 +2710,10 @@ function res (): void {
27102710
//フォームの表示時刻をセット
27112711
set_form_display_time();
27122712

2713+
if($res_catalog){
2714+
krsort($out[0]);
2715+
}
2716+
27132717
$admin_pass= null;
27142718
$templete= $res_catalog ? 'res_catalog.html' : 'res.html';
27152719
include __DIR__.'/'.$skindir.$templete;

0 commit comments

Comments
 (0)