-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Carpet plot rebase #1595
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
Carpet plot rebase #1595
Conversation
@@ -14,6 +14,7 @@ var extendFlat = require('../../../lib/extend').extendFlat; | |||
|
|||
|
|||
module.exports = { | |||
visible: axesAttrs.visible, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visible
for 3D axes doesn't actually works, correct?
I think you had to put it in there so that supplyDefaults
doesn't error out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, correct. Was contemplating the best option as was working back through that. Correct though, it was just to make them not fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the right answer is not to remove the attribute and avoid supplying that default in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scene.?axis.visible: false
would be a nice option too. So I don't think it's worth changing the logic. Opening a new issue about implementing ?axis.visible
in 3D will suffice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #1599
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow, nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1599 is now merged in this PR.
PR of the year candidate 🏆 |
|
||
// If too long, truncate. (If too short, it will grow | ||
// automatically so we don't care about that case) | ||
out.length = n; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, never knew you could resize this way!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best I can tell, it's actually robust and supported across platforms. It's possible it does weird things internally (like not actually de-allocating that memory. I saw a while ago some discussion of the various internal string apis and string data structures in js. Hint: it's not straightforward). The main goal was to just overwrite the carpet spline stuff rather than allocating everything from scratch every time since that adds up to lots of garbage collection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/length
The array length property sets or returns the number of elements in an array.
That's right, [..] sets or returns [..].
It's not a read-only property like one might assume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(best-case scenario though is that it actually truncates in-place without actually copying. I mean maybe copies, but slice()
definitely copies.)
var bbox = drawing.bBox(dummyText.node()); | ||
dummyText.remove(); | ||
return bbox; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see why you did it this way, but it seems a little redundant, we're making a new node only to clone it in the global tester, then we delete them both. If this ends up getting called a lot, for performance we may want to break up drawing.bBox
in such a way that this element can get created in the global tester in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I didn't appreciate that the tester was also cloning it. And to add to that, it looks like I only ended up using it in one place. 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(but on the plus side, to answer your question, at least it doesn't end up getting called a lot 😄 )
test/jasmine/tests/carpet_test.js
Outdated
expect(traceOut.db).toBeUndefined(); | ||
expect(traceOut.a0).toBeUndefined(); | ||
expect(traceOut.b0).toBeUndefined(); | ||
expect(traceOut.visible).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rreusser looks like only this assertion fails when removing the if(!test.supplyDefaults) return;
statement above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by the way @rreusser I'm adding a few restyle
test cases on a branch, so I can take care of
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're already editing it, then 👍 . I think most of the carpet tests should actually be moved out of this file since a lot of the functions being tested are better suited for lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in c98553a
- and replace it by Lib.extendFlat({}, /* */)
- no need to coerce attribute that don't have an effect
A few more carpet plot tests
Axis visible in 3D
@rreusser a well-earned 💃 Not sure if @alexcjohnson 's #1595 (comment) is blocking though. 🎉 🚀 🚀 🚀 🚀 🚀 🚀 🚀 🚀 🎉 |
Nah, if it only gets sparing use it's not blocking. Awesome work @rreusser & @etpinard ! |
Removed nonetheless. You're correct that it really wasn't needed there and wasn't used elsewhere. 👍 |
baxis: extendFlat({}, axisAttrs), | ||
font: { | ||
family: extendFlat({}, fontAttrs.family, { | ||
dflt: '"Open Sans", verdana, arial, sans-serif' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point. Yes, I valid to make the switch now. Though it's technically a change, I think the number of actual breakages would be outweighed by API consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great - I just noticed some of these things as I'm pushing more of the restyle/relayout logic into the schema... I'll take care of these after I'm done with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it too late to make this inherit from the global layout.font?
Nop, not too late. I'd call this a bug fix.
].join(' ') | ||
}, | ||
|
||
fixedrange: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rreusser does fixedrange
do anything on a carpet axis? Can I remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔪
This PR breaks up a couple not-really-related or loosely-related commits from carpet plots into separate commits and rebases all of carpet plots into one big commit. Supersedes #1239.