From de9ba53e74298a93b18833058c3cb43dc4d0ecf8 Mon Sep 17 00:00:00 2001 From: Simon He <57086651+Simon-He95@users.noreply.github.com> Date: Tue, 5 Dec 2023 09:48:35 +0800 Subject: [PATCH] chore(core): fix typo (#5222) --- packages/core/src/element/combo.ts | 4 ++-- packages/core/src/element/edge.ts | 2 +- packages/core/src/element/hull/bubbleset.ts | 4 ++-- packages/core/src/element/xml.ts | 12 ++++++------ packages/core/src/graph/controller/item.ts | 2 +- packages/core/src/graph/controller/layout.ts | 6 +++--- packages/core/src/interface/graph.ts | 4 ++-- packages/core/src/item/node.ts | 12 ++++++------ packages/core/src/util/path.ts | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/core/src/element/combo.ts b/packages/core/src/element/combo.ts index b7dda9cafff..c7c1a9b1034 100644 --- a/packages/core/src/element/combo.ts +++ b/packages/core/src/element/combo.ts @@ -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; diff --git a/packages/core/src/element/edge.ts b/packages/core/src/element/edge.ts index 4fe9f45cce7..331744fc8d3 100644 --- a/packages/core/src/element/edge.ts +++ b/packages/core/src/element/edge.ts @@ -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; } diff --git a/packages/core/src/element/hull/bubbleset.ts b/packages/core/src/element/hull/bubbleset.ts index ed18bb9d84a..21208f89a95 100644 --- a/packages/core/src/element/hull/bubbleset.ts +++ b/packages/core/src/element/hull/bubbleset.ts @@ -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 @@ -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; diff --git a/packages/core/src/element/xml.ts b/packages/core/src/element/xml.ts index 3245ead6a12..f10b2381747 100644 --- a/packages/core/src/element/xml.ts +++ b/packages/core/src/element/xml.ts @@ -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; @@ -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])); } } diff --git a/packages/core/src/graph/controller/item.ts b/packages/core/src/graph/controller/item.ts index 59e04b92d56..1514834b68b 100644 --- a/packages/core/src/graph/controller/item.ts +++ b/packages/core/src/graph/controller/item.ts @@ -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; diff --git a/packages/core/src/graph/controller/layout.ts b/packages/core/src/graph/controller/layout.ts index 757bc87015c..ccb90e325ce 100644 --- a/packages/core/src/graph/controller/layout.ts +++ b/packages/core/src/graph/controller/layout.ts @@ -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 @@ -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]; diff --git a/packages/core/src/interface/graph.ts b/packages/core/src/interface/graph.ts index 0cc46a02cc8..76c8528a80b 100644 --- a/packages/core/src/interface/graph.ts +++ b/packages/core/src/interface/graph.ts @@ -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; diff --git a/packages/core/src/item/node.ts b/packages/core/src/item/node.ts index f1d35f672cf..32fbb329a89 100644 --- a/packages/core/src/item/node.ts +++ b/packages/core/src/item/node.ts @@ -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); } /** diff --git a/packages/core/src/util/path.ts b/packages/core/src/util/path.ts index 35727d7434d..c7bbd809666 100644 --- a/packages/core/src/util/path.ts +++ b/packages/core/src/util/path.ts @@ -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]; @@ -354,4 +354,4 @@ export const getStarPath = (outerR: number, innerR: number) => { path.push(['Z']); return path; -} \ No newline at end of file +}