@@ -51,15 +51,23 @@ class Webshot extends CallableInstance {
this.height = boundary;
boundary = null;
x = Math.floor(this.width / 2);
- let flag = 0;
+ let flag = false;
+ let cnt = 0;
for (let y = this.height - 1; y >= 0; y--) {
const idx = (this.width * y + x) << 2;
if (this.data[idx] !== 255) {
- boundary = y;
if (!flag)
- flag = 1;
- else
- break;
+ cnt++;
+ flag = true;
+ }
+ else {
+ if (flag)
+ flag = false;
+ if (cnt === 3) {
+ boundary = y;
+ break;
}
if (boundary != null) {
@@ -64,13 +64,20 @@ class Webshot extends CallableInstance {
+ if (!flag) cnt++;
+ } else {
+ if (flag) cnt++;
boundary = y;
- if (!flag) flag = 1;
- else break;