-
Notifications
You must be signed in to change notification settings - Fork 3
3_Board_Tools
The board tools located in bleepsix/js/brdtool
often have a lot of logic
in them. This section is meant to briefly describe what the more complex tools
are doing.
Most tools have a common interaction pattern of
- left click is an action
- right click/hold to pan zoom
- mouse wheel to zoom
- respect the snap grid
- escape to revert to the default tool (toolBoardNav)
bleepsix/js/brdtoo/toolTrace.js
toolTrace
is in charge of laying down tracks. It keeps track of the current
list of track segments while the user clicks.
Things get complicated when collisions occur. The general policy is to keep the last known good state of the layed down tool trace and if a collision occurs don't allow trace placement.
There is a feature called 'magnet pads' which 'grabs' the layed down track if they get close enough to a magnetized pad or track. Pads and tracks are magnetized if they are of the same net as the trace being layed down, as implied by the schematic.
This is implemented by having a wider area that is considered in the collision detection. Pads and tracks not of the same net will still allow connections but the cursor must be within a smaller region.
When collisions are detected, the trace 'ghosts' to allow for continued visual feedback but to give an indication that the trace placement is invalid. The last known good trace placement still appears on the board.
As of this writing there is a known bug that comes up when pads are too close and there hasn't been an initial trace placement.
Further features could include an 'unwind' feature whereby pressing escape would jump back one trace instead of discarding the tool.
bleepsix/js/brdtool/toolBoardMove.js
toolBoardMove
is in charge of board element movement. This could include single
footprints, traces or groups thereof. Rotations are included.
Complications arise when trying to place groups of elements when there's an intersection. The general policy is to allow for movement but 'ghost' parts when they collide with already placed parts.
A bounding box collision is done to begin with to speed up the test. Only if there are bounding
box collisions does the underlying polygon geometry class (that is calls to the JavaScript clipperlib
)
happen to determine whether a collision occurs.
As previously stated, future improvements could be to rate limit unghosting if there are bounding box collisions.
bleepsix/js/brdtool/toolFootprintPlace.js
toolFootprintPlace
is in charge of creating footprints or updating to new footprints.
When selecting a footprint from the library, the toolFootprintPlace
tool will be instanciated.
toolFootprintPlace
looks like toolMove
in a lot of ways but it's in charge of creating
new footprints rather than moving them around.
Footprint components already placed can also be replaced with a new footprint by hovering the floating footprint to the placed footprint.
Unassociated (that is, 'unknown') footprints can also be associated to footprints in this way