跳转到内容

pivotick v3.0.0


pivotick / 模拟

接口: Simulation ​

定义于:Simulation.ts:174

方法 ​

applyPhysicsPreset() ​

applyPhysicsPreset(name): void

定义于:Simulation.ts:972

应用命名预设(PHYSICS_PRESETS):设置每个旋钮并重新加热一次,点击_REHEAT_ALPHA,而不是滑块默认值 - 预设描述了整个布局,从固定的图形到达它需要新布局的旅行。

参数 ​

name ​

PhysicsPresetName

返回值 ​

void


changeLayout() ​

changeLayout(type, simulationOptions): Promise<void>

定义于:Simulation.ts:1524

允许更改图表的布局

参数 ​

type ​

LayoutType

simulationOptions ​

DeepPartial<SimulationOptions> = {}

返回值 ​

Promise<void>

示例 ​

ts
changeLayout('tree', {
    layout: {
         horizontal: false,
         rootIdAlgorithmFinder: 'FirstZeroInDegree'
    }
})

destroy() ​

destroy(): void

定义于:Simulation.ts:365

停止引擎并释放容器观察者。

返回值 ​

void


disable() ​

disable(): void

定义于:Simulation.ts:569

返回值 ​

void


disableAutoPhysics() ​

disableAutoPhysics(): void

定义于:Simulation.ts:1216

关闭 Auto,将旋钮留在当前所在的位置。

返回值 ​

void


enable() ​

enable(): void

定义于:Simulation.ts:563

返回值 ​

void


enableAutoPhysics() ​

enableAutoPhysics(): void

定义于:Simulation.ts:1210

打开Auto并立即调谐。 force,因为这是自动按钮:死区内的答案将使单击不执行任何可见操作。

返回值 ​

void


enableAutoTreeSpacing() ​

enableAutoTreeSpacing(): void

定义于:Simulation.ts:1111

将树间距交还给调整器,调整器根据节点大小和树形状重新导出乘数,并在图形发生变化时继续这样做。 setTreeSpacing的对应项。在强制布局下无操作,其中Auto是enableAutoPhysics。

返回值 ​

void


getForceSimulation() ​

getForceSimulation(): SimulationForces

定义于:Simulation.ts:1503

返回值 ​

SimulationForces


getLabelSide() ​

getLabelSide(id): LabelSide | undefined

定义于:Simulation.ts:1039

当布局选择一个时,节点的浮动标签位于其节点的哪一侧 - 只有 structured 布局会这样做。

参数 ​

id ​

string

返回值 ​

LabelSide | undefined


getLayoutType() ​

getLayoutType(): LayoutType

定义于:Simulation.ts:1010

活动布局类型 — 物理弹出按钮会在非 force 布局下使物理变灰。

返回值 ​

LayoutType


getPhysicsKnobs() ​

getPhysicsKnobs(): PhysicsKnobs

定义于:Simulation.ts:1005

当前旋钮值,用于设置物理弹出滑块的种子值。

返回值 ​

PhysicsKnobs


getSimulation() ​

getSimulation(): Simulation<Node, undefined>

定义于:Simulation.ts:1507

返回值 ​

Simulation<Node, undefined>


getTreeRoot() ​

getTreeRoot(): TreeRoot

定义于:Simulation.ts:1076

活动树悬挂的位置。在强制布局下没有树,因此这会报告查找器以树开始,并且没有引脚。

返回值 ​

TreeRoot


getTreeSpacing() ​

getTreeSpacing(): TreeSpacing

定义于:Simulation.ts:1044

活动树布局的间距乘数;力布局下1×。

返回值 ​

TreeSpacing


isAutoPhysicsEnabled() ​

isAutoPhysicsEnabled(): boolean

定义于:Simulation.ts:1202

Auto 预设当前正在驱动旋钮吗?

返回值 ​

boolean


isAutoTreeSpacingEnabled() ​

isAutoTreeSpacingEnabled(): boolean

定义于:Simulation.ts:1101

树间距是自己调整的吗?力布局下false。

返回值 ​

boolean


isDragging() ​

isDragging(): boolean

定义于:Simulation.ts:1460

返回值 ​

boolean


isEnabled() ​

isEnabled(): boolean

定义于:Simulation.ts:737

返回值 ​

boolean


isFitViewOnExpandCollapse() ​

isFitViewOnExpandCollapse(): boolean

定义于:Simulation.ts:1484

返回值 ​

boolean


isFreezeNodesOnDrag() ​

isFreezeNodesOnDrag(): boolean

定义于:Simulation.ts:1472

返回值 ​

boolean


isGridSnappingEnabled() ​

isGridSnappingEnabled(): boolean

定义于:Simulation.ts:1476

返回值 ​

boolean


pause() ​

pause(): void

定义于:Simulation.ts:577

暂停模拟

返回值 ​

void


refreshForcesAndReheat() ​

refreshForcesAndReheat(alpha): void

定义于:Simulation.ts:874

重新读取节点相关的力访问器并重新加热。 d3-force 在初始化力时缓存每个节点的半径/强度,而不是每个刻度,因此在重新设置节点之前,运行中途发生突变的半径不会产生任何影响。对于在打开布局冷却后自行测量的自定义节点。禁用时无操作。

参数 ​

alpha ​

number = 0.5

返回值 ​

void


reheat() ​

reheat(alpha): void

定义于:Simulation.ts:861

用一点热量重新启动模拟

参数 ​

alpha ​

number = 0.7

返回值 ​

void


restart() ​

restart(): void

定义于:Simulation.ts:585

重新启动模拟并在每个动画帧上进行渲染。

返回值 ​

void


setCentering() ​

setCentering(knob): void

定义于:Simulation.ts:942

拉向画布中心。旋钮 0–100 → d3GravityStrengthConnected,后面跟着 d3GravityStrength(孤立节点)作为固定倍数。单独的组件只会相互排斥,因此这是将它们保持在框架中的唯一方法。

参数 ​

knob ​

number

返回值 ​

void


setCollisionRadius() ​

setCollisionRadius(knob): void

定义于:Simulation.ts:919

节点间距。旋钮 4–60 → d3CollideRadiusMultiplier(缩放每个节点的碰撞半径)。

参数 ​

knob ​

number

返回值 ​

void


setFriction() ​

setFriction(knob): void

定义于:Simulation.ts:929

运动阻尼。旋钮 0–100 → d3VelocityDecay (÷100)。每次滴答时均实时应用 - 无需重新加热。

参数 ​

knob ​

number

返回值 ​

void


setLinkDistance() ​

setLinkDistance(knob): void

定义于:Simulation.ts:909

优选的边长。旋钮 40–600 (px) → d3LinkDistance。

参数 ​

knob ​

number

返回值 ​

void


setRepulsion() ​

setRepulsion(knob): void

定义于:Simulation.ts:898

推开力。旋钮 0–100 → d3ManyBodyStrength。

参数 ​

knob ​

number

返回值 ​

void


setSettleTime() ​

setSettleTime(knob): void

定义于:Simulation.ts:958

布局需要多长时间才能稳定下来,以秒为单位。旋钮 0.5–8 → d3AlphaDecay * 和 * cooldownTime 一起:alpha 衰减设置 sim 冷却的速度,冷却时间是停止它的挂钟墙。单独移动任何一个都没有任何作用——提高冷却时间,模拟市民已经很冷了;减缓腐烂,墙壁将其截断。

参数 ​

knob ​

number

返回值 ​

void


setTreeRoot() ​

setTreeRoot(root): void

定义于:Simulation.ts:1088

从另一个根重新挂起树:{ rootId }将其固定到该节点,{ algorithm }放下固定并让查找者进行选择。强制布局下无操作,没有根层次结构。

固定的根在忽略边缘方向的情况下行走,因此任何节点(包括叶子)都会给出一整棵树,而不是旧树旁边的树桩。请参阅TreeLayout。setRoot。

参数 ​

root ​

{ rootId: string; } | { algorithm: TreeLayoutAlgorithm; }

返回值 ​

void


setTreeSpacing() ​

setTreeSpacing(spacing): void

定义于:Simulation.ts:1055

以新的间距乘数 (TREE_SPACING_RANGE) 重新布局树。在力布局下无操作,其中间距是物理旋钮的工作。

重绘 * 和 * 重新加热:固定轴立即移动,因此即使物理暂停,也会显示变化,而自由轴仍然固定在新的同级插槽中。

参数 ​

spacing ​

Partial<TreeSpacing>

返回值 ​

void


snapToGrid() ​

snapToGrid(value): number

定义于:Simulation.ts:1499

当启用网格捕捉时,将图形空间坐标捕捉到网格(否则无操作)。公共的非模拟可拖动对象(例如注释)可以与节点捕捉到同一网格上。

参数 ​

value ​

number

返回值 ​

number


start() ​

start(recomputeLayout): Promise<void>

定义于:Simulation.ts:595

从每个动画帧上的渲染开始模拟。

参数 ​

recomputeLayout ​

boolean = true

返回值 ​

Promise<void>


stop() ​

stop(): void

定义于:Simulation.ts:628

手动停止模拟并取消动画帧。

返回值 ​

void


toggleFitViewOnExpandCollapse() ​

toggleFitViewOnExpandCollapse(): void

定义于:Simulation.ts:1480

返回值 ​

void


toggleFreezeNodesOnDrag() ​

toggleFreezeNodesOnDrag(): void

定义于:Simulation.ts:1468

返回值 ​

void


toggleGridSnapping() ​

toggleGridSnapping(): void

定义于:Simulation.ts:1464

返回值 ​

void


update() ​

update(): void

定义于:Simulation.ts:486

返回值 ​

void


waitForSimulationStop() ​

waitForSimulationStop(): Promise<void>

定义于:Simulation.ts:723

返回一个在模拟自然停止时解决的承诺。对于稳定后执行操作(如fitAndCenter)很有用。

返回值 ​

Promise<void>