Closed samuel-massinon closed 8 years ago
One thing I would like to do is only show
vector origin
when the option picked isuse vector
, but I'm not sure how to do that.
What do you mean?
So in the picture below is an image of the gist above. You see how vector origin
in the two sprites is empty? That's because they are not needed, and anything put into them will not be used. So not having them there would make things simpler.
Ahhh. I imagine something related to what's done for array rows might work? Though I'm not sure what's done there. Normally I'd put an onchange event on the <select>
element, but I guess that's not a <select>
element, right? Because these are actually custom elements.
@CelticMinstrel: I've tried a few ways but nothing easy has worked yet. I was able to added a onchange to <select>
but there was still some issues. I'm going to put that work that in a different pull request since it can't be an independent feature.
This pull request is ready to merge. Currently Vector Origin
is there even when it's not used, you can look at the examples for an, uh, example.
Hi @samuel-massinon-invenia, I think we've been talking past each other. I finally had a chance to sit down with your code and I see what you were trying to do, but I think it would be confusing for new users.
The idea we had with rectangles before is that sometimes you want the origin point (and rotation point, but that's another kettle of worms) to be on the upper left corner and sometimes you want it to be in the rectangle's center. And yes, sometimes you want those to be the screen origin of 0,0, especially when drawing a sprite, but I don't ever want to make the origin of a rectangle 0,0 implicitly. There should always be a block that says (0,0) in some way. We might want it to have a default block like that, but there should always be a block for the origin, not an implicit origin from an unrelated menu.
Does that make sense?
That makes sense. And that's what I'm trying to accomplish with "Rectangle Origin".
That's given me a new idea. I think it would be great if the drop down could fill in the "Vector Origin" with the selected value so that users can see the origin explicitly.
What I didn't like about the old way was that "orientation" and "rectangle at" were independent and to me unclear. Having anything other than vector (0,0) with center doesn't make sense, at least to me.
"rectangle at" literally specified where the rectangle is onscreen. "orientation" (which was poorly named) specified how the rectangle was drawn relative to its location - is it centred on that location, or is that location one of its vertices?
Though I think it would be okay to remove the "orientation" parameter and always draw the rectangle from the top left (rather than centred), having the "centred" option does mean you have less calculations to deal with if you want to change the rectangle's size without changing its centre.
I think having good collision routines makes "draw from centre" less relevant (centre point is more convenient for collisions if you have to roll your own collisions in WB). The other place where drawing from the centre helps is with rotation, but we can just handle that in the rotate code and not burden the users with so many API options. I guess centring on the playground is another case, but maybe not enough to worry about.
So +1 for removing orientation and just drawing from the corner all the time.
I too like that idea of removing orientation. I'll work on that.
Here's the new version. Let me know what you think.
I think that looks better. I think we should rename "zero vector" to be "origin" but that's a different matter.
That would be less correct - the "origin" is certainly represented by a zero vector, but it's not the only use of a zero vector.
There's really no need to have a separate "zero vector" block though, as the zero vector can easily be represented with the arbitrary vector block. Having the separate block is like making a numeric block just for "zero".
Agree that there are other uses for the zero vector, but I think the idea of having shapes built around <0,0> is confusing if we name the block vector <0,0>
. We can try it out in practice though.
Like I said though, there's also no particular reason to have it as a separate block at all.
Well, given that Vectors default to 0,0 anyway, that's probably true.
I think this should be good to go, any further changes, if any, can go in a separate issue. :shipit:
Not yetReady to merge, still need to make sure all examples work.Here's a gist example of it working with this code
7e3e17fc32fd6c857885
One thing I would like to do is only show
vector origin
when the option picked isuse vector
, but I'm not sure how to do that.