How to use the jointjs.g.Point function in jointjs

To help you get started, we’ve selected a few jointjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ProcessMaker / modeler / src / targetValidationUtils.js View on Github external
function isPointOverPaper(mouseX, mouseY, paperContainer) {
  const { left, top, width, height } = paperContainer.getBoundingClientRect();
  const rect = new g.rect(left, top, width, height);
  const point = new g.Point(mouseX, mouseY);

  return rect.containsPoint(point);
}
github ProcessMaker / modeler / src / portsUtils.js View on Github external
function getClosestAnchorPoint(model, coords, group) {
  const referencePoint = new g.Point(coords.x, coords.y);
  return referencePoint.chooseClosest(getModelPortPoints(model, group));
}
github ProcessMaker / modeler / src / portsUtils.js View on Github external
function getModelPortPoints(model, group) {
  const { x: modelX, y: modelY } = model.position();
  const points = Object.values(model.getPortsPositions(group))
    .map(({ x, y }) => new g.Point(modelX + x, modelY + y));
  if (!points) {
    const { x, y } = model.position();
    const { width, height } = model.size();
    points.push(new g.Point(x - (width / 2), y - (height / 2)));
  }
  return points;
}
github ProcessMaker / modeler / src / portsUtils.js View on Github external
    .map(({ x, y }) => new g.Point(modelX + x, modelY + y));
  if (!points) {