@cosmos.gl/graph 2.3.0 → 2.3.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +683 -658
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +37 -14
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/Lines/draw-curve-line.vert +7 -2
- package/src/modules/Points/draw-points.vert +19 -1
- package/src/modules/Points/index.ts +13 -1
package/package.json
CHANGED
|
@@ -63,7 +63,11 @@ float calculateArrowWidth(float arrowWidth) {
|
|
|
63
63
|
if (scaleLinksOnZoom) {
|
|
64
64
|
return arrowWidth;
|
|
65
65
|
} else {
|
|
66
|
-
|
|
66
|
+
// Apply the same scaling logic as calculateLinkWidth to maintain proportionality
|
|
67
|
+
arrowWidth = arrowWidth / transformationMatrix[0][0];
|
|
68
|
+
// Apply the same non-linear scaling to avoid extreme widths
|
|
69
|
+
arrowWidth *= min(5.0, max(1.0, transformationMatrix[0][0] * 0.01));
|
|
70
|
+
return arrowWidth;
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -100,7 +104,8 @@ void main() {
|
|
|
100
104
|
float arrowWidth = linkWidth * k;
|
|
101
105
|
arrowWidth *= arrowSizeScale;
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
// Ensure arrow width difference is non-negative to prevent unwanted changes to link width
|
|
108
|
+
float arrowWidthDifference = max(0.0, arrowWidth - linkWidth);
|
|
104
109
|
|
|
105
110
|
// Calculate arrow width in pixels
|
|
106
111
|
float arrowWidthPx = calculateArrowWidth(arrowWidth);
|
|
@@ -21,6 +21,8 @@ uniform vec4 backgroundColor;
|
|
|
21
21
|
uniform bool scalePointsOnZoom;
|
|
22
22
|
uniform float maxPointSize;
|
|
23
23
|
uniform bool darkenGreyout;
|
|
24
|
+
uniform bool renderOnlySelected;
|
|
25
|
+
uniform bool renderOnlyUnselected;
|
|
24
26
|
|
|
25
27
|
varying vec2 textureCoords;
|
|
26
28
|
varying vec3 rgbColor;
|
|
@@ -39,6 +41,23 @@ float calculatePointSize(float size) {
|
|
|
39
41
|
|
|
40
42
|
void main() {
|
|
41
43
|
textureCoords = pointIndices;
|
|
44
|
+
|
|
45
|
+
// Check greyout status for selective rendering
|
|
46
|
+
vec4 greyoutStatus = texture2D(pointGreyoutStatus, (textureCoords + 0.5) / pointsTextureSize);
|
|
47
|
+
bool isSelected = greyoutStatus.r == 0.0;
|
|
48
|
+
|
|
49
|
+
// Discard point based on rendering mode
|
|
50
|
+
if (renderOnlySelected && !isSelected) {
|
|
51
|
+
gl_Position = vec4(2.0, 2.0, 2.0, 1.0); // Move off-screen
|
|
52
|
+
gl_PointSize = 0.0;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (renderOnlyUnselected && isSelected) {
|
|
56
|
+
gl_Position = vec4(2.0, 2.0, 2.0, 1.0); // Move off-screen
|
|
57
|
+
gl_PointSize = 0.0;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
42
61
|
// Position
|
|
43
62
|
vec4 pointPosition = texture2D(positionsTexture, (textureCoords + 0.5) / pointsTextureSize);
|
|
44
63
|
vec2 point = pointPosition.rg;
|
|
@@ -55,7 +74,6 @@ void main() {
|
|
|
55
74
|
alpha = color.a * pointOpacity;
|
|
56
75
|
|
|
57
76
|
// Adjust alpha of selected points
|
|
58
|
-
vec4 greyoutStatus = texture2D(pointGreyoutStatus, (textureCoords + 0.5) / pointsTextureSize);
|
|
59
77
|
if (greyoutStatus.r > 0.0) {
|
|
60
78
|
if (greyoutColor[0] != -1.0) {
|
|
61
79
|
rgbColor = greyoutColor.rgb;
|
|
@@ -239,6 +239,8 @@ export class Points extends CoreModule {
|
|
|
239
239
|
darkenGreyout: () => store.darkenGreyout,
|
|
240
240
|
scalePointsOnZoom: () => config.scalePointsOnZoom,
|
|
241
241
|
maxPointSize: () => store.maxPointSize,
|
|
242
|
+
renderOnlySelected: reglInstance.prop<{ renderOnlySelected: boolean }, 'renderOnlySelected'>('renderOnlySelected'),
|
|
243
|
+
renderOnlyUnselected: reglInstance.prop<{ renderOnlyUnselected: boolean }, 'renderOnlyUnselected'>('renderOnlyUnselected'),
|
|
242
244
|
},
|
|
243
245
|
blend: {
|
|
244
246
|
enable: true,
|
|
@@ -542,7 +544,17 @@ export class Points extends CoreModule {
|
|
|
542
544
|
const { config: { renderHoveredPointRing, pointSize }, store, data } = this
|
|
543
545
|
if (!this.colorBuffer) this.updateColor()
|
|
544
546
|
if (!this.sizeBuffer) this.updateSize()
|
|
545
|
-
|
|
547
|
+
|
|
548
|
+
// Render in layers: unselected points first (behind), then selected points (in front)
|
|
549
|
+
if (store.selectedIndices && store.selectedIndices.length > 0) {
|
|
550
|
+
// First draw unselected points (they will appear behind)
|
|
551
|
+
this.drawCommand?.({ renderOnlySelected: false, renderOnlyUnselected: true })
|
|
552
|
+
// Then draw selected points (they will appear in front)
|
|
553
|
+
this.drawCommand?.({ renderOnlySelected: true, renderOnlyUnselected: false })
|
|
554
|
+
} else {
|
|
555
|
+
// If no selection, draw all points
|
|
556
|
+
this.drawCommand?.({ renderOnlySelected: false, renderOnlyUnselected: false })
|
|
557
|
+
}
|
|
546
558
|
if ((renderHoveredPointRing) && store.hoveredPoint) {
|
|
547
559
|
this.drawHighlightedCommand?.({
|
|
548
560
|
width: 0.85,
|