Skip to content

Commit

Permalink
chore(auto-place): improve JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Jan 16, 2024
1 parent fe58cc7 commit 6603227
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions lib/features/auto-place/AutoPlaceUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ export function generateGetNextPosition(nextPositionDirection) {
}

/**
* Return target at given position, if defined.
* Return connected element at given position and within given bounds. Takes
* connected elements from host and attachers into account, too.
*
* This takes connected elements from host and attachers
* into account, too.
* @param {Shape} source
* @param {Point} position
* @param {Shape} element
*
* @return {Shape|undefined}
*/
export function getConnectedAtPosition(source, position, element) {

Expand Down Expand Up @@ -255,13 +259,13 @@ export function getConnectedDistance(source, hints) {
}

/**
* Returns all connected elements around the given source.
* Returns all elements connected to given source.
*
* This includes:
*
* - connected elements
* - host connected elements
* - attachers connected elements
* - elements connected to source
* - elements connected to host if source is an attacher
* - elements connected to attachers if source is a host
*
* @param {Shape} source
*
Expand All @@ -284,6 +288,13 @@ function getAutoPlaceClosure(source) {
return allConnected;
}

/**
* Get all connected elements.
*
* @param {Shape} element
*
* @returns {Shape[]}
*/
function getConnected(element) {
return getTargets(element).concat(getSources(element));
}
Expand Down

0 comments on commit 6603227

Please sign in to comment.