Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
Issue #329
  • Loading branch information
rsoika committed Feb 19, 2024
1 parent 19a8894 commit 76f990b
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions open-bpmn.glsp-client/open-bpmn-glsp/src/bpmn-select-listeners.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
import {
isBPMNLabelNode,
isBoundaryEvent,
isLaneDivider,
isLaneNode,
isPoolNode,
isTaskNode
Expand All @@ -51,8 +52,12 @@ export class BPMNElementSnapper implements ISnapper {

snap(position: Point, _element: GModelElement): Point {

// if (isLaneDivider(_element)) {
// return this.findLaneDividerSnapPoint(_element, position);
if (isLaneDivider(_element)) {
return this.findLaneDividerSnapPoint(_element, position);
}

// if (isBoundaryEvent(_element)) {
// return this.findBoundarySnapPointOld(_element, position);
// }

// move routing-points by 5x5
Expand All @@ -63,39 +68,25 @@ export class BPMNElementSnapper implements ISnapper {
};
}

// default move 10x10...
// default move 1x1...
return {
x: Math.round(position.x / this.grid.x) * this.grid.x,
y: Math.round(position.y / this.grid.y) * this.grid.y
x: Math.round(position.x),
y: Math.round(position.y)
};
}



/*
* This helper method computes the snap Position of a Lane-Divider.
* The position is based on the Bounds of the containing Pool.
* The final position is always on the x position of the Pool.
*/
/*
private findLaneDividerSnapPoint(element: GModelElement, position: Point): Point {
const x = 0;
let y = position.y;
console.log(' snap lane devider current pos = ' + x + ',' + y)
// test min / max position
if (hasArgs(element)) {
const yMin = Number(element.args.ymin);
const yMax = Number(element.args.ymax);
if (y < yMin) {
y = yMin;
}
if (y > yMax) {
y = yMax;
}
}
// return the new position;
const y = position.y;
return { x: x, y: y };
}
*/
}

/**
Expand Down

0 comments on commit 76f990b

Please sign in to comment.