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

feat(i3s): Add an option to multiply colors by attribute #2519

Merged
merged 3 commits into from
Jun 27, 2023

Conversation

maxkuznetsov-actionengine
Copy link
Collaborator

@belom88 Please review

@maxkuznetsov-actionengine maxkuznetsov-actionengine changed the title feat: Add an option to multiply colors by attribute feat(i3s): Add an option to multiply colors by attribute Jun 20, 2023
modules/i3s/src/lib/utils/customizeColors.ts Outdated Show resolved Hide resolved
@belom88 belom88 requested a review from ibgreen June 21, 2023 12:06
if (options.i3s.colorsByAttribute.mode === 'multiply') {
const multupliedColor = colors.value.subarray(i * 4, i * 4 + 3);
for (let j = 0; j < 4; j++) {
multupliedColor[j] = (multupliedColor[j] * color[j]) / 255;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo

Suggested change
multupliedColor[j] = (multupliedColor[j] * color[j]) / 255;
multipliedColor[j] = (multipliedColor[j] * color[j]) / 255;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

/* eslint max-statements: ["error", 30] */
/* eslint complexity: ["error", 12] */
if (options.i3s.colorsByAttribute.mode === 'multiply') {
const multupliedColor = colors.value.subarray(i * 4, i * 4 + 3);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Generates a lot of small objects, perf / GC.

What happens if you just multiply all elements in the array "in situ"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will be working fine, fixed

@maxkuznetsov-actionengine maxkuznetsov-actionengine merged commit 41ed756 into master Jun 27, 2023
@maxkuznetsov-actionengine maxkuznetsov-actionengine deleted the feature/ES-404 branch June 27, 2023 08:03
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.

3 participants