Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(core): fix typo #5222

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/src/element/combo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ const singleCombo: ShapeOptions = {
},
updateCollapsedIcon(cfg: ComboConfig, item: Item, keyShapeStyle: ShapeStyle) {
const { collapsed, collapsedSubstituteIcon = {} } = cfg;
const subsitututeIconConfig = Object.assign({}, this.options.collapsedSubstituteIcon, collapsedSubstituteIcon)
const { show, img, width, height } = subsitututeIconConfig;
const substituteIconConfig = Object.assign({}, this.options.collapsedSubstituteIcon, collapsedSubstituteIcon)
const { show, img, width, height } = substituteIconConfig;
const group = item.getContainer();
let collapsedIconShape = group.find(ele => ele.get('name') === 'combo-collapsed-substitute-icon');
const iconShapeExist = collapsedIconShape && !collapsedIconShape.destroyed;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/element/edge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const singleEdge: ShapeOptions = {
};
}
style = { ...cfg.style };
if (style.lineWidth === undefined) style.lineWdith = (isNumber(size) ? size : size?.[0]) || currentAttr.lineWidth
if (style.lineWidth === undefined) style.lineWidth = (isNumber(size) ? size : size?.[0]) || currentAttr.lineWidth
if (style.path === undefined) style.path = path;
if (style.stroke === undefined) style.stroke = currentAttr.stroke || cfg.color;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/element/hull/bubbleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ function getRoute(
}

/**
* Calculate the countor that includes the selected items and exclues the non-selected items
* Calculate the counter that includes the selected items and exclues the non-selected items
* @param graph
* @param members
* @param nonMembers
Expand Down Expand Up @@ -448,7 +448,7 @@ export const genBubbleSet = (members: Item[], nonMembers: Item[], ops?: Bubblese
return hull;
}

// update parameters for next iteraction
// update parameters for next iteration
options.threshold *= 0.9;
if (iterations <= options.maxMarchingIterations * 0.5) {
options.memberInfluenceFactor *= 1.2;
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/element/xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ export function parseXML(xml: HTMLElement, cfg) {
export function getBBox(
node: NodeInstructure,
offset: { x: number; y: number },
chilrenBBox: { width: number; height: number },
childrenBBox: { width: number; height: number },
) {
const { attrs = {} } = node;
const bbox = {
x: offset.x || 0,
y: offset.y || 0,
width: chilrenBBox.width || 0,
height: chilrenBBox.height || 0,
width: childrenBBox.width || 0,
height: childrenBBox.height || 0,
};

let shapeHeight, shapeWidth;
Expand Down Expand Up @@ -404,11 +404,11 @@ export function compareTwoTarget(nowTarget: NodeInstructure, formerTarget: NodeI

if (nowTarget.children?.length > 0 || formerTarget.children?.length > 0) {
const length = Math.max(nowTarget.children?.length, formerTarget.children?.length);
const formerChilren = formerTarget.children || [];
const nowChilren = nowTarget.children || [];
const formerChildren = formerTarget.children || [];
const nowChildren = nowTarget.children || [];

for (let index = 0; index < length; index += 1) {
children.push(compareTwoTarget(nowChilren[index], formerChilren[index]));
children.push(compareTwoTarget(nowChildren[index], formerChildren[index]));
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/graph/controller/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default class ItemController {
group: comboGroup,
});

// if it is a circle combo, diagnal length of the children's bbox should be the diameter of the combo's bbox
// if it is a circle combo, diagonal length of the children's bbox should be the diameter of the combo's bbox
if (!model.collapsed && item.getKeyShape().get('type') === 'circle') {
comboBBox.width = Math.hypot(comboBBox.height, comboBBox.width);
comboBBox.height = comboBBox.width;
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/graph/controller/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export default abstract class LayoutController {

protected isLayoutTypeSame(cfg): boolean {
const current = this.getLayoutCfgType(cfg);
const preHasPipies = Array.isArray(this.layoutType);
const preHasPipes = Array.isArray(this.layoutType);
const currentHasPipes = Array.isArray(current);
// already has pipes, and the new one is pipes
if (preHasPipies && currentHasPipes) {
if (preHasPipes && currentHasPipes) {
return (this.layoutType as string[]).every((type, index) => type === current[index]);
}
// only one of the pre and current is pipes
Expand Down Expand Up @@ -333,7 +333,7 @@ export default abstract class LayoutController {
if (!isFinite(vertiGap) || !horiGap) vertiGap = 0;
const beginX = center[0] - width / 2;
const beginY = center[1] - height / 2;

let allHavePos = true;
for (let i = 0; i < nodeLength; i++) {
const node = nodesToInit[i];
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/interface/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ export interface IAbstractGraph extends EventEmitter {
/**
* Fits the passed items into the view. If no items are passed it will fit the whole graph
* @param {Item[]} items Items you want to fit into the view
* @param {boolean} zoomToFit Wether to zoom on the passed items
* @param {boolean} animate Wheter to animate the transition
* @param {boolean} zoomToFit Whether to zoom on the passed items
* @param {boolean} animate Whether to animate the transition
* @param {GraphAnimateConfig} animateCfg Animation configuration
*/
focusItems: (items: Item[], zoomToFit?: boolean, animate?: boolean, animateCfg?: GraphAnimateConfig) => void;
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/item/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,24 @@ export default class Node extends Item implements INode {

if (type === 'target') {
// 当前节点为 source,它所指向的目标节点
const neighhborsConverter = (edge: IEdge) => {
const neighborsConverter = (edge: IEdge) => {
return edge.getSource() === this;
};
return edges.filter(neighhborsConverter).map((edge) => edge.getTarget());
return edges.filter(neighborsConverter).map((edge) => edge.getTarget());
}
if (type === 'source') {
// 当前节点为 target,它所指向的源节点
const neighhborsConverter = (edge: IEdge) => {
const neighborsConverter = (edge: IEdge) => {
return edge.getTarget() === this;
};
return edges.filter(neighhborsConverter).map((edge) => edge.getSource());
return edges.filter(neighborsConverter).map((edge) => edge.getSource());
}

// 若未指定 type ,则返回所有邻居
const neighhborsConverter = (edge: IEdge) => {
const neighborsConverter = (edge: IEdge) => {
return edge.getSource() === this ? edge.getTarget() : edge.getSource();
};
return edges.map(neighhborsConverter);
return edges.map(neighborsConverter);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/util/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const pathToPoints = (path: any[]) => {
*/
export const getClosedSpline = (points: IPoint[]) => {
if (points.length < 2) {
throw new Error(`point length must largn than 2, now it's ${points.length}`);
throw new Error(`point length must larger than 2, now it's ${points.length}`);
}
const first = points[0];
const second = points[1];
Expand Down Expand Up @@ -354,4 +354,4 @@ export const getStarPath = (outerR: number, innerR: number) => {

path.push(['Z']);
return path;
}
}
Loading