Skip to content

Commit

Permalink
refactor(dia.Paper): remove linkConnectionPoint option (#2437)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumilingus authored Dec 14, 2023
1 parent 5fcc12a commit f7bb456
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 89 deletions.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions packages/joint-core/src/dia/LinkView.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -976,13 +976,6 @@ export const LinkView = CellView.extend({
var anchor = line.end;
var paperOptions = this.paper.options;

// Backwards compatibility
if (typeof paperOptions.linkConnectionPoint === 'function') {
var linkConnectionMagnet = (magnet === view.el) ? undefined : magnet;
connectionPoint = paperOptions.linkConnectionPoint(this, view, linkConnectionMagnet, line.start, endType);
if (connectionPoint) return connectionPoint;
}

if (!connectionPointDef) return anchor;
var connectionPointFn;
if (typeof connectionPointDef === 'function') {
Expand Down
50 changes: 0 additions & 50 deletions packages/joint-core/src/util/util.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -455,56 +455,6 @@ export const cancelFrame = (function() {

})();

/**
* @deprecated
*/
export const shapePerimeterConnectionPoint = function(linkView, view, magnet, reference) {

var bbox;
var spot;

if (!magnet) {

// There is no magnet, try to make the best guess what is the
// wrapping SVG element. This is because we want this "smart"
// connection points to work out of the box without the
// programmer to put magnet marks to any of the subelements.
// For example, we want the function to work on basic.Path elements
// without any special treatment of such elements.
// The code below guesses the wrapping element based on
// one simple assumption. The wrapping element is the
// first child of the scalable group if such a group exists
// or the first child of the rotatable group if not.
// This makes sense because usually the wrapping element
// is below any other sub element in the shapes.
var scalable = view.$('.scalable')[0];
var rotatable = view.$('.rotatable')[0];

if (scalable && scalable.firstChild) {

magnet = scalable.firstChild;

} else if (rotatable && rotatable.firstChild) {

magnet = rotatable.firstChild;
}
}

if (magnet) {

spot = V(magnet).findIntersection(reference, linkView.paper.cells);
if (!spot) {
bbox = V(magnet).getBBox({ target: linkView.paper.cells });
}

} else {

bbox = view.model.getBBox();
spot = bbox.intersectionWithLineFromCenterToPoint(reference);
}
return spot || bbox.center();
};

export const isPercentage = function(val) {

return isString(val) && val.slice(-1) === '%';
Expand Down
13 changes: 0 additions & 13 deletions packages/joint-core/types/joint.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -993,16 +993,6 @@ export namespace dia {
useLinkTools?: boolean;
}

interface GetConnectionPoint {
(
linkView: LinkView,
view: ElementView,
magnet: SVGElement,
reference: Point,
end: LinkEnd
): Point;
}

interface LabelOptions extends Cell.Options {
absoluteDistance?: boolean;
reverseDistance?: boolean;
Expand Down Expand Up @@ -1257,7 +1247,6 @@ export namespace dia {
height?: Dimension;
origin?: Point;
perpendicularLinks?: boolean;
linkConnectionPoint?: LinkView.GetConnectionPoint;
drawGrid?: boolean | GridOptions | GridOptions[];
drawGridSize?: number | null;
background?: BackgroundOptions;
Expand Down Expand Up @@ -2417,8 +2406,6 @@ export namespace util {

export function cancelFrame(requestId: number): void;

export var shapePerimeterConnectionPoint: dia.LinkView.GetConnectionPoint;

export function isPercentage(val: any): boolean;

export function parseCssNumeric(val: any, restrictUnits: string | string[]): { value: number, unit?: string } | null;
Expand Down

0 comments on commit f7bb456

Please sign in to comment.