tapspace
Version:
A zoomable user interface lib for web apps
25 lines (22 loc) • 611 B
JavaScript
module.exports = function (pivot) {
// @Viewport:snapPixels([pivot])
//
// Snap viewport position and angle to pixels when the angle is near
// a multitude of 90 degrees.
// Note that in perspective view mode the snapping is a lost cause,
// because almost nothing is exact.
//
// Parameters:
// pivot
// optional Point. Snap rotation around this point.
//
// Return
// this, for chaining
//
// Delegate to each basis space.
const spaces = this.hyperspace.getChildren()
for (let i = 0; i < spaces.length; i += 1) {
spaces[i].snapPixels(pivot)
}
return this
}