mirror of
https://github.com/tiennm99/WPlace-AutoBOT.git
synced 2026-10-14 12:16:36 +00:00
work please
This commit is contained in:
1 parent
6658c6eae3
commit
7b0d1bc73b
1 file changed
+16
-2
+16
-2
@@ -1332,7 +1332,15 @@
|
||||
const y = Math.max(0, Math.min(cached.h - 1, pixelY));
|
||||
const idx = (y * cached.w + x) * 4;
|
||||
const d = cached.data;
|
||||
return [d[idx], d[idx + 1], d[idx + 2], d[idx + 3]];
|
||||
const a = d[idx + 3];
|
||||
const alphaThresh = state.customTransparencyThreshold || CONFIG.TRANSPARENCY_THRESHOLD;
|
||||
if (a < alphaThresh) {
|
||||
// Treat as transparent / unavailable
|
||||
// Lightweight debug: show when transparency causes skip (only if verbose enabled)
|
||||
if (window._overlayDebug) console.debug('getTilePixelColor: transparent pixel, skipping', tileKey, x, y, a);
|
||||
return null;
|
||||
}
|
||||
return [d[idx], d[idx + 1], d[idx + 2], a];
|
||||
}
|
||||
|
||||
// Fallback: draw stored bitmap to canvas and read single pixel
|
||||
@@ -1356,7 +1364,13 @@
|
||||
const x = Math.max(0, Math.min(bitmap.width - 1, pixelX));
|
||||
const y = Math.max(0, Math.min(bitmap.height - 1, pixelY));
|
||||
const data = ctx.getImageData(x, y, 1, 1).data;
|
||||
return [data[0], data[1], data[2], data[3]];
|
||||
const a = data[3];
|
||||
const alphaThresh = state.customTransparencyThreshold || CONFIG.TRANSPARENCY_THRESHOLD;
|
||||
if (a < alphaThresh) {
|
||||
if (window._overlayDebug) console.debug('getTilePixelColor: transparent pixel (fallback), skipping', tileKey, x, y, a);
|
||||
return null;
|
||||
}
|
||||
return [data[0], data[1], data[2], a];
|
||||
} catch (e) {
|
||||
console.warn('OverlayManager.getTilePixelColor failed for', tileKey, pixelX, pixelY, e);
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user