@cosmograph/cosmos
Advanced tools
Comparing version 2.0.0-beta.16 to 2.0.0-beta.17
@@ -33,3 +33,3 @@ import { D3ZoomEvent } from 'd3-zoom'; | ||
*/ | ||
defaultPointColor?: string | [number, number, number, number]; | ||
pointColor?: string | [number, number, number, number]; | ||
/** | ||
@@ -45,3 +45,3 @@ * Greyed out point opacity value when the selection is active. | ||
*/ | ||
defaultPointSize?: number; | ||
pointSize?: number; | ||
/** | ||
@@ -93,3 +93,3 @@ * Scale factor for the point size. | ||
*/ | ||
defaultLinkColor?: string | [number, number, number, number]; | ||
linkColor?: string | [number, number, number, number]; | ||
/** | ||
@@ -104,3 +104,3 @@ * Greyed out link opacity value when the selection is active. | ||
*/ | ||
defaultLinkWidth?: number; | ||
linkWidth?: number; | ||
/** | ||
@@ -137,3 +137,3 @@ * Scale factor for the link width. | ||
*/ | ||
defaultLinkArrows?: boolean; | ||
linkArrows?: boolean; | ||
/** | ||
@@ -417,5 +417,5 @@ * Scale factor for the link arrows size. | ||
spaceSize: number; | ||
defaultPointColor: string; | ||
pointColor: string; | ||
pointGreyoutOpacity: number; | ||
defaultPointSize: number; | ||
pointSize: number; | ||
pointSizeScale: number; | ||
@@ -427,5 +427,5 @@ hoveredPointCursor: string; | ||
focusedPointIndex: undefined; | ||
defaultLinkColor: string; | ||
linkColor: string; | ||
linkGreyoutOpacity: number; | ||
defaultLinkWidth: number; | ||
linkWidth: number; | ||
linkWidthScale: number; | ||
@@ -437,3 +437,3 @@ renderLinks: boolean; | ||
curvedLinkControlPointDistance: number; | ||
defaultLinkArrows: boolean; | ||
linkArrows: boolean; | ||
linkArrowsSizeScale: number; | ||
@@ -440,0 +440,0 @@ linkVisibilityDistanceRange: number[]; |
{ | ||
"name": "@cosmograph/cosmos", | ||
"version": "2.0.0-beta.16", | ||
"version": "2.0.0-beta.17", | ||
"description": "GPU-based force graph layout and rendering", | ||
@@ -5,0 +5,0 @@ "jsdelivr": "dist/index.min.js", |
@@ -46,3 +46,3 @@ import { D3ZoomEvent } from 'd3-zoom' | ||
*/ | ||
defaultPointColor?: string | [number, number, number, number]; | ||
pointColor?: string | [number, number, number, number]; | ||
@@ -59,3 +59,3 @@ /** | ||
*/ | ||
defaultPointSize?: number; | ||
pointSize?: number; | ||
/** | ||
@@ -114,3 +114,3 @@ * Scale factor for the point size. | ||
*/ | ||
defaultLinkColor?: string | [number, number, number, number]; | ||
linkColor?: string | [number, number, number, number]; | ||
@@ -126,3 +126,3 @@ /** | ||
*/ | ||
defaultLinkWidth?: number; | ||
linkWidth?: number; | ||
/** | ||
@@ -159,3 +159,3 @@ * Scale factor for the link width. | ||
*/ | ||
defaultLinkArrows?: boolean; | ||
linkArrows?: boolean; | ||
/** | ||
@@ -199,3 +199,3 @@ * Scale factor for the link arrows size. | ||
*/ | ||
simulationGravity?: number; | ||
simulationGravity?: number; | ||
/** | ||
@@ -464,5 +464,5 @@ * Centering to center mass force coefficient. | ||
public spaceSize = defaultConfigValues.spaceSize | ||
public defaultPointColor = defaultPointColor | ||
public pointColor = defaultPointColor | ||
public pointGreyoutOpacity = defaultGreyoutPointOpacity | ||
public defaultPointSize = defaultPointSize | ||
public pointSize = defaultPointSize | ||
public pointSizeScale = defaultConfigValues.pointSizeScale | ||
@@ -474,5 +474,5 @@ public hoveredPointCursor = defaultConfigValues.hoveredPointCursor | ||
public focusedPointIndex = defaultConfigValues.focusedPointIndex | ||
public defaultLinkColor = defaultLinkColor | ||
public linkColor = defaultLinkColor | ||
public linkGreyoutOpacity = defaultGreyoutLinkOpacity | ||
public defaultLinkWidth = defaultLinkWidth | ||
public linkWidth = defaultLinkWidth | ||
public linkWidthScale = defaultConfigValues.linkWidthScale | ||
@@ -484,3 +484,3 @@ public renderLinks = defaultConfigValues.renderLinks | ||
public curvedLinkControlPointDistance = defaultConfigValues.curvedLinkControlPointDistance | ||
public defaultLinkArrows = defaultConfigValues.arrowLinks | ||
public linkArrows = defaultConfigValues.arrowLinks | ||
public linkArrowsSizeScale = defaultConfigValues.arrowSizeScale | ||
@@ -487,0 +487,0 @@ public linkVisibilityDistanceRange = defaultConfigValues.linkVisibilityDistanceRange |
@@ -206,19 +206,19 @@ import { select, Selection } from 'd3-selection' | ||
this.config.init(config) | ||
if (prevConfig.defaultPointColor !== this.config.defaultPointColor) { | ||
if (prevConfig.pointColor !== this.config.pointColor) { | ||
this.graph.updatePointColor() | ||
this.points.updateColor() | ||
} | ||
if (prevConfig.defaultPointSize !== this.config.defaultPointSize) { | ||
if (prevConfig.pointSize !== this.config.pointSize) { | ||
this.graph.updatePointSize() | ||
this.points.updateSize() | ||
} | ||
if (prevConfig.defaultLinkColor !== this.config.defaultLinkColor) { | ||
if (prevConfig.linkColor !== this.config.linkColor) { | ||
this.graph.updateLinkColor() | ||
this.lines.updateColor() | ||
} | ||
if (prevConfig.defaultLinkWidth !== this.config.defaultLinkWidth) { | ||
if (prevConfig.linkWidth !== this.config.linkWidth) { | ||
this.graph.updateLinkWidth() | ||
this.lines.updateWidth() | ||
} | ||
if (prevConfig.defaultLinkArrows !== this.config.defaultLinkArrows) { | ||
if (prevConfig.linkArrows !== this.config.linkArrows) { | ||
this.graph.updateArrows() | ||
@@ -225,0 +225,0 @@ this.lines.updateArrow() |
@@ -70,3 +70,3 @@ import { getRgbaColor, isNumber } from '@/graph/helper' | ||
// Sets point colors to default values from config if the input is missing or does not match input points number. | ||
const defaultRgba = getRgbaColor(this._config.defaultPointColor) | ||
const defaultRgba = getRgbaColor(this._config.pointColor) | ||
if (this.inputPointColors === undefined || this.inputPointColors.length / 4 !== this.pointsNumber) { | ||
@@ -102,3 +102,3 @@ this.pointColors = new Float32Array(this.pointsNumber * 4) | ||
if (this.inputPointSizes === undefined || this.inputPointSizes.length !== this.pointsNumber) { | ||
this.pointSizes = new Float32Array(this.pointsNumber).fill(this._config.defaultPointSize) | ||
this.pointSizes = new Float32Array(this.pointsNumber).fill(this._config.pointSize) | ||
} else { | ||
@@ -108,3 +108,3 @@ this.pointSizes = this.inputPointSizes | ||
if (!isNumber(this.pointSizes[i])) { | ||
this.pointSizes[i] = this._config.defaultPointSize | ||
this.pointSizes[i] = this._config.pointSize | ||
} | ||
@@ -129,3 +129,3 @@ } | ||
// Sets link colors to default values from config if the input is missing or does not match input links number. | ||
const defaultRgba = getRgbaColor(this._config.defaultLinkColor) | ||
const defaultRgba = getRgbaColor(this._config.linkColor) | ||
if (this.inputLinkColors === undefined || this.inputLinkColors.length / 4 !== this.linksNumber) { | ||
@@ -162,3 +162,3 @@ this.linkColors = new Float32Array(this.linksNumber * 4) | ||
if (this.inputLinkWidths === undefined || this.inputLinkWidths.length !== this.linksNumber) { | ||
this.linkWidths = new Float32Array(this.linksNumber).fill(this._config.defaultLinkWidth) | ||
this.linkWidths = new Float32Array(this.linksNumber).fill(this._config.linkWidth) | ||
} else { | ||
@@ -168,3 +168,3 @@ this.linkWidths = this.inputLinkWidths | ||
if (!isNumber(this.linkWidths[i])) { | ||
this.linkWidths[i] = this._config.defaultLinkWidth | ||
this.linkWidths[i] = this._config.linkWidth | ||
} | ||
@@ -186,3 +186,3 @@ } | ||
if (this.linkArrowsBoolean === undefined || this.linkArrowsBoolean.length !== this.linksNumber) { | ||
this.linkArrows = new Array(this.linksNumber).fill(+this._config.defaultLinkArrows) | ||
this.linkArrows = new Array(this.linksNumber).fill(+this._config.linkArrows) | ||
} else { | ||
@@ -189,0 +189,0 @@ this.linkArrows = this.linkArrowsBoolean.map(d => +d) |
@@ -486,3 +486,3 @@ import regl from 'regl' | ||
public draw (): void { | ||
const { config: { renderHoveredPointRing, defaultPointSize }, store, data } = this | ||
const { config: { renderHoveredPointRing, pointSize }, store, data } = this | ||
if (!this.colorBuffer) this.updateColor() | ||
@@ -496,3 +496,3 @@ if (!this.sizeBuffer) this.updateSize() | ||
pointIndex: store.hoveredPoint.index, | ||
size: data.pointSizes?.[store.hoveredPoint.index] ?? defaultPointSize, | ||
size: data.pointSizes?.[store.hoveredPoint.index] ?? pointSize, | ||
}) | ||
@@ -505,3 +505,3 @@ } | ||
pointIndex: store.focusedPoint.index, | ||
size: data.pointSizes?.[store.focusedPoint.index] ?? defaultPointSize, | ||
size: data.pointSizes?.[store.focusedPoint.index] ?? pointSize, | ||
}) | ||
@@ -508,0 +508,0 @@ } |
@@ -29,8 +29,8 @@ import { GraphConfigInterface } from '@/graph/config' | ||
backgroundColor: '#212C42', | ||
defaultPointSize: 3, | ||
defaultPointColor: '#4B5BBF', | ||
pointSize: 3, | ||
pointColor: '#4B5BBF', | ||
pointGreyoutOpacity: 0.1, | ||
defaultLinkWidth: 0.2, | ||
defaultLinkColor: '#5F74C2', | ||
defaultLinkArrows: false, | ||
linkWidth: 0.2, | ||
linkColor: '#5F74C2', | ||
linkArrows: false, | ||
linkGreyoutOpacity: 0, | ||
@@ -37,0 +37,0 @@ curvedLinks: true, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
3390282
20548