Skip to content

feat: Add options.ignoreMask of pixels to skip - #171

Merged
mourner merged 1 commit into
mapbox:mainfrom
Venefilyn:feat/ignore-areas
Oct 4, 2026
Merged

mourner merged 1 commit into
mapbox:mainfrom
Venefilyn:feat/ignore-areas

Conversation

@Venefilyn

@Venefilyn Venefilyn commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

New check where if a value from ignoreMask is greater than 0 it will
be ignored from the check. The ignore mask itself needs to be exact
width and height of the images provided.

One could write an array manually or provide a PNG image by use of a
custom helper function beforehand, further making it more extensible.
Any value greater than 0 will be skipped.

Tests have been updated to include one test with a normal diff check
with an ignore mask that covers half the screen, and another diff check
where nothing should differ as all the changes are within the ignore mask but makes sure the fast path is executed.

Fixes: #163
Closes: #153

@Venefilyn
Venefilyn requested a review from a team as a code owner September 7, 2026 13:15
@Venefilyn
Venefilyn requested review from stepankuzmin and removed request for a team September 7, 2026 13:15
@ox-security

ox-security Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

OX Security Logo

OX Security reviewed this pull request — nothing to fix.

✔ No issues found

Branch feat/ignore-areas → main

View scan in OX Security →

@mourner mourner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a bunch of tests are failing — let's make sure the CI is green first

@Venefilyn

Copy link
Copy Markdown
Contributor Author

Looks like a bunch of tests are failing — let's make sure the CI is green first

Woops, was refactoring and made a mistake in the if-statement. Should've been

-        if (!inIgnoreMask && a32[i] === b32[i]) {
+        if (!inIgnoreMask && a32[i] !== b32[i]) {

Comment thread index.js Outdated
Comment thread index.js Outdated
@Venefilyn
Venefilyn requested a review from mourner October 2, 2026 15:26
Comment thread index.js Outdated
Comment thread index.js Outdated
Comment thread index.js Outdated
@mourner

mourner commented Oct 2, 2026

Copy link
Copy Markdown
Member

Also, it seems like adding two sets of fixtures for this is a bit redundant — we could get away with just one (one darker, and a diff that shows only the non-masked portion was highlighted).

@Venefilyn

Copy link
Copy Markdown
Contributor Author

Also, it seems like adding two sets of fixtures for this is a bit redundant — we could get away with just one (one darker, and a diff that shows only the non-masked portion was highlighted).

Would you say 9a and 9b is enough then? I added fixture 10 to ensure check the fast check works with it

@mourner

mourner commented Oct 3, 2026

Copy link
Copy Markdown
Member

Ah, I guess we could leave those then. So, a few nits left and I'll land this before v8 release.

@Venefilyn
Venefilyn force-pushed the feat/ignore-areas branch 2 times, most recently from 7a54774 to d90a958 Compare October 3, 2026 23:34
New check where if a value from `ignoreMask` is greater than 0 it will
be ignored from the check. The ignore mask itself needs to be exact
width and height of the images provided.

One could write an array manually or provide a PNG image by use of a
custom helper function beforehand, further making it more extensible.
Any value greater than 0 will be skipped.

Tests have been updated to include one test with a normal diff check
with an ignore mask that covers half the screen, and another diff check
where nothing should differ as all the changes are within the ignore mask but makes sure the fast path is executed.

Fixes: mapbox#163
Closes: mapbox#153
Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
@Venefilyn

Copy link
Copy Markdown
Contributor Author

Alrighty, updated based on last review. Updated the fast check as I had an incorrect statement there so it would never mark identical if it was inside an ignore change.

Before we go ahead with merging this, do we agree on options.ignoreMask or should we pick a different synonym? I'm fine with ignoreMask but unsure what users think :D

@mourner
mourner removed the request for review from stepankuzmin October 4, 2026 08:12
@mourner
mourner merged commit 8856bdc into mapbox:main Oct 4, 2026
2 checks passed
@mourner

mourner commented Oct 4, 2026

Copy link
Copy Markdown
Member

Great, thanks for being patient and getting this over the finish line! ignoreMask sounds good to me. I'll do some polishing and release v8 in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support exclusion zones

2 participants