-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support for axis without arrow head(s) #38
Comments
In the above commits, I added There is a lot of duplication between |
AxisLine sounds reasonable, but I'm wondering what you think about using the ArrowNode API for customizing it. For instance, setting an arrow head width/height to 0? Or combining that with |
That was option (2) in #38 (comment). It's more complicated and will involve options that can't be combined. I sort of double that ArrowNode supports headWidth:0 or headHeight:0, and I really don't want to touch ArrowNode. So I'm inclined to rename AxisNode to AxisArrowNode, and call this done. @samreid thoughts? |
I guess another approach would be class AxisNode extends Node {
options = merge( {
value: 0, // by default the axis is at 0, but you can put it somewhere else
extension: 20, // in view coordinates, how far the axis goes past the edge of the ChartRectangle
useArrowNode: true, // true=use ArrowNode and arrowNodeOptions, false= use Line and lineOptions
// ArrowNode options
arrowNodeOptions: {
doubleHead: true,
headHeight: 10,
headWidth: 10,
tailWidth: 2
},
// Line options
lineOptions: {
lineWidth: 2
}
}, options );
} |
That seems the best solution to me. Still sound good to you? |
In the above commits, I renamed AxisNode to AxisArrowNode, and I used AxisLine in one bamboo demo. I was surprised to find that AxisNode was not used outside of the bamboo demos. Since this is a breaking API change, I announced on the Google Group at https://groups.google.com/g/developing-interactive-simulations-in-html5/c/1Zm4l3sye20/m/Iy34b9jRAAAJ. @samreid have a look, feel free to close if it looks OK. |
I reviewed the commits and tested the ChartCanvasNode demo. It seems reasonable and I don't have any recommendations, closing. |
Axes are frequently need to be drawn without arrow heads in PhET sims. To accomplish that using bamboo's AxisNode, you have to clip to the ChartRectange to remove the parts of the axis (including the arrow head or heads) that extend past the edges.
So something like what I've done in base class
WaveformChartNode
in Fourier:This is inconvenient, and I'd like to have a way of creating axes that do not have arrow heads. Some ways to accomplish that:
(1) Add an option to AxisNode, maybe something like:
This would be a rewrite of AxisNode, since it currently extends ArrowNode and uses its options. Surprisingly, I only see AxisNode used in Fourier.
(2) Create a new type of axis Node that does not involve arrows. The
extension
option might still be nice to have, but default to0
. This involves coming up with a good name for the new class, and probably coming up with a new name for AxisNode -- maybe AxisLine and AxisArrowNode, since they are subclasses (specializations) of Line and ArrowNode? This is definitely the easier of the 2 approaches.@samreid thoughts?
The text was updated successfully, but these errors were encountered: