|
@@ -154,7 +154,7 @@ class Webshot extends CallableInstance {
|
|
|
const idx = (x, y) => (this.width * y + x) << 2;
|
|
|
let boundary = null;
|
|
|
let x = zoomFactor * 2;
|
|
|
- for (let y = 0; y < this.height; y++) {
|
|
|
+ for (let y = 0; y < this.height; y += zoomFactor) {
|
|
|
if (this.data[idx(x, y)] !== 255 &&
|
|
|
this.data[idx(x, y)] === this.data[idx(x + zoomFactor * 10, y)]) {
|
|
|
if (this.data[idx(x, y + 18 * zoomFactor)] !== 255) {
|
|
@@ -175,7 +175,7 @@ class Webshot extends CallableInstance {
|
|
|
x = Math.floor(16 * zoomFactor);
|
|
|
let flag = false;
|
|
|
let cnt = 0;
|
|
|
- for (let y = this.height - 1; y >= 0; y--) {
|
|
|
+ for (let y = this.height - 1 - zoomFactor; y >= 0; y -= zoomFactor) {
|
|
|
if ((this.data[idx(x, y)] === 255) === flag) {
|
|
|
cnt++;
|
|
|
flag = !flag;
|
|
@@ -189,15 +189,15 @@ class Webshot extends CallableInstance {
|
|
|
// if there are a "retweet" count and "like" count row, this will be the line above it
|
|
|
if (cnt === 4) {
|
|
|
const b = y + 1;
|
|
|
- if (this.height - boundary - (boundary - b) <= 1) {
|
|
|
+ if (Math.abs(this.height - boundary - (boundary - b)) <= 3 * zoomFactor) {
|
|
|
boundary = b;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // // if "retweet" count and "like" count are two rows, this will be the line above the first
|
|
|
- // if (cnt === 6) {
|
|
|
- // const c = y + 1;
|
|
|
- // if (this.height - boundary - 2 * (boundary - c) <= 2) {
|
|
|
- // boundary = c;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // if "retweet" count and "like" count are two rows, this will be the line above the first
|
|
|
+ if (cnt === 6) {
|
|
|
+ const c = y + 1;
|
|
|
+ if (Math.abs(this.height - boundary - 2 * (boundary - c)) <= 3 * zoomFactor) {
|
|
|
+ boundary = c;
|
|
|
break;
|
|
|
}
|
|
|
}
|