phetsims / circuit-construction-kit-common

"Circuit Construction Kit: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
10 stars 10 forks source link

Make it impossible to connect wires outside of the black box in build mode #136

Closed samreid closed 8 years ago

samreid commented 8 years ago

From #128

I think we should add a rule that components cannot be connected when outside of the black box in build mode.

samreid commented 8 years ago

@arouinfar said:

Something's still not quite right here @samreid.

I think we should add a rule that components cannot be connected when outside of the black box in build mode.

If I connect a fixed-length component to the outside of the black box in Build mode, it remains outside. I can continue to build outside of the black box if I connect other fixed-length components to the first one.

externalnodes

After deleting the battery attached to the black box, the other battery floats in the playspace. It does not snap to the inside of the black box until it is clicked.

To avoid this issue, would it be possible for fixed-length components to rotate into the black box if they are connected to a black box vertex from the outside? Sort of like this: batteryrotation

Assigning to @phet-steele to be on the lookout for additional related issues when he works on #134.

samreid commented 8 years ago

My original thought was to prevent that kind of connection in the first place. I like the idea of rotating batteries in, so I'll investigate that next, but it will likely be instantaneous rather than animated.

samreid commented 8 years ago

Also, I'm somewhat concerned that flipping the battery inside the box could cause it to overlap some other vertex and make it bump out of the way--so there could be odd interactions.

arouinfar commented 8 years ago

I'm somewhat concerned that flipping the battery inside the box could cause it to overlap some other vertex and make it bump out of the way

You raise an excellent point @samreid. Perhaps it's better to prevent the connection altogether.

samreid commented 8 years ago

OK I'll investigate preventing the connection first.

samreid commented 8 years ago

This is implemented as prescribed and it seems like it is working nicely. I wouldn't be surprised to find many corner cases though, so it should be thoroughly tested.

samreid commented 8 years ago

Please refer to https://github.com/phetsims/circuit-construction-kit/issues/140 for testing.

samreid commented 8 years ago

This seems like it is working properly, closing.