Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Filter hitArea not updating #10530

Merged
merged 2 commits into from
May 14, 2024
Merged

Fix: Filter hitArea not updating #10530

merged 2 commits into from
May 14, 2024

Conversation

GoodBoyDigital
Copy link
Member

Description of change

This PR simplifies the filter mixin a little bit. In the process it also fixes #10524.

Pre-Merge Checklist
  • Tests and/or benchmarks are included
  • Documentation is changed or added
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

@GoodBoyDigital GoodBoyDigital requested a review from Zyie May 13, 2024 14:26
Copy link

korbit-ai bot commented May 13, 2024

My review is in progress 📖 - I will have feedback for you in a few minutes!

Copy link

codesandbox-ci bot commented May 13, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit cb418be:

Sandbox Source
pixi.js-sandbox Configuration

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

I have reviewed your code and found 1 potential issue. To discuss my individual comments that I have added, tag me in replies using @korbit-ai.


Please react with a 👍 to my comments that you find helpful and a 👎 to those you find unhelpful - this will help me learn and improve as we collaborate.


// Clone the filters array so we don't freeze the user-input
value = Array.isArray(value) ? value.slice(0) : value;

// Ensure filters are immutable via filters getter
this._filters.filters = Object.freeze(value);
effect.filters = Object.freeze(value);
Copy link

Choose a reason for hiding this comment

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

category Readability and Maintainability

The code is directly mutating the 'filters' property of the FilterEffect instance. While this might not cause any immediate issues, it's generally a good practice to avoid direct mutation of object properties. Instead, consider using a method to update the property which can also handle any necessary side effects or validations.

@vitch
Copy link

vitch commented May 13, 2024

When this lands will it be possible to dynamically change filterArea? Do you think there would be a performance benefit to doing so?

In my case I have a pixi-viewport which is the whole size of my "world" (256,000x256,000px) and I add and remove children within it as you pan so the whole world can be seen.

For now the filterArea is set to the whole size of the world and it performs fine (60fps). But do you think it will be more performant to dynamically change the filterArea as you pan the viewport?

@Zyie Zyie changed the title bugfix - Fix Filter hitArea Fix: Filter hitArea not updating May 14, 2024
@Zyie Zyie added ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t v8 labels May 14, 2024
* simplify masking

* tidy
@Zyie Zyie added this pull request to the merge queue May 14, 2024
Merged via the queue into dev with commit af5db9e May 14, 2024
4 checks passed
@Zyie Zyie deleted the bugfix/filters-simplify branch May 14, 2024 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
korbit-code-analysis ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t v8
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: filterArea only works if it is set before filters
3 participants