Skip to content

Commit 8bc099d

Browse files
author
Adityacode-hub
committed
refactor(SensorsBlocks): remove duplicate methods and consolidate pixel data handling
- Removed duplicate getPixelDataFromMedia method - Merged pixel data handling into unified getPixelData method - Updated arg method to use the consolidated getPixelData - Improved error handling and documentation - Fixed RGB component indexing in GetBlueBlock and GetGreenBlock - Made code more maintainable and DRY This change eliminates code duplication while preserving all functionality and improving error handling across the SensorsBlocks implementation.
1 parent 76764f9 commit 8bc099d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

js/blocks/SensorsBlocks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -999,8 +999,8 @@ class GetColorMediaBlock extends ValueBlock {
999999
*/
10001000
/**
10011001
* Gets pixel color data from either the canvas or a media block.
1002-
* @param {number} x - The x-coordinate of the pixel.
1003-
* @param {number} y - The y-coordinate of the pixel.
1002+
* @param {number} x - The x-coordinate of the pixel to sample.
1003+
* @param {number} y - The y-coordinate of the pixel to sample.
10041004
* @param {Object} [mediaBlock] - Optional media block to read from.
10051005
* @returns {Uint8ClampedArray} - The RGBA values of the pixel.
10061006
* @throws {Error} - If the canvas context is unavailable or media access fails.

0 commit comments

Comments
 (0)