Files
Superalgos/Projects/Foundations/UI/Utilities/CoordinateTransformations.js
T

26 lines
950 B
JavaScript

function newFoundationsUtilitiesCoordinateTransformations() {
let thisObject = {
transformThisPoint: transformThisPoint,
unTransformThisPoint: unTransformThisPoint
}
return thisObject
function transformThisPoint(point, container) {
/* We make the point relative to the current frame */
point = container.frame.frameThisPoint(point)
/* We pass this point through the UI.projects.foundations.spaces.chartingSpace.viewport lends, meaning we apply the UI.projects.foundations.spaces.chartingSpace.viewport zoom and displacement. */
point = UI.projects.foundations.spaces.chartingSpace.viewport.transformThisPoint(point)
return point
}
function unTransformThisPoint(point, container) {
point = UI.projects.foundations.spaces.chartingSpace.viewport.unTransformThisPoint(point)
point = container.frame.unframeThisPoint(point)
return point
}
}