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

interpolateNumberArray #77

Merged
merged 9 commits into from Nov 20, 2019
Merged

interpolateNumberArray #77

merged 9 commits into from Nov 20, 2019

Conversation

Fil
Copy link
Member

@Fil Fil commented Nov 19, 2019

  • interpolates typed arrays (Float64Array, etc) and standard arrays that contain only numbers with a simple for… loop.
  • autodetects both situations (we could optionally unplug the number array detection) [EDIT: unplugged]
  • not compatible with BigInt typed arrays (Support BigInt? #75)

- interpolates typed arrays (Float64Array, etc) and standard arrays that contain only numbers with a simple for… loop.
- autodetects both situations (we could optionally unplug the number array detection)
- not compatible with BigInt typed arrays (#75)
@Fil Fil requested a review from mbostock November 19, 2019 18:46
@Fil
Copy link
Member Author

Fil commented Nov 19, 2019

supersedes #65 and #74

src/array.js Outdated Show resolved Hide resolved
test/numberArray-test.js Outdated Show resolved Hide resolved
src/numberArray.js Outdated Show resolved Hide resolved
src/numberArray.js Outdated Show resolved Hide resolved
src/numberArray.js Outdated Show resolved Hide resolved
Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

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

Added a tiny optimization to avoid a redundant call to isNumberArray in the d3.interpolate code path.

@Fil Fil merged commit 903d6fe into master Nov 20, 2019
@Fil Fil deleted the interpolateNumberArray branch November 20, 2019 21:02
@mbostock mbostock mentioned this pull request Nov 20, 2019
2 tasks
@Fil Fil mentioned this pull request Nov 21, 2019
}

export function isNumberArray(x) {
return ArrayBuffer.isView(x) && !(x instanceof DataView);
Copy link

Choose a reason for hiding this comment

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

Hi! Just wanted to flag that typeof ArrayBuffer.isView === 'undefined' in PhantomJS. I know it's a super old browser and I'm not really expecting D3 to be perfectly compatible with it, but just commenting here in case someone else gets the same error. Thanks!

re: openstreetmap/iD#7072 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

we could test for it?

return ArrayBuffer.isView && ArrayBuffer.isView(x) && !(x instanceof DataView);

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

Successfully merging this pull request may close these issues.

None yet

3 participants