From d95fab73163e128731f0d6db37b3db09cd678ba6 Mon Sep 17 00:00:00 2001 From: Yomguithereal Date: Thu, 19 May 2022 10:16:30 +0200 Subject: [PATCH 1/4] Avoiding to rely on graphology for types We should rely on graphology-types instead Related to #1244 --- src/core/labels.ts | 2 +- src/sigma.ts | 2 +- src/utils/animate.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/labels.ts b/src/core/labels.ts index c4f40246c..c117bb66f 100644 --- a/src/core/labels.ts +++ b/src/core/labels.ts @@ -5,7 +5,7 @@ * Miscelleneous heuristics related to label display. * @module */ -import Graph from "graphology"; +import Graph from "graphology-types"; import { Dimensions, Coordinates } from "../types"; diff --git a/src/sigma.ts b/src/sigma.ts index c6bc2bfe8..b0c9a6246 100644 --- a/src/sigma.ts +++ b/src/sigma.ts @@ -3,7 +3,7 @@ * ======== * @module */ -import Graph from "graphology"; +import Graph from "graphology-types"; import Camera from "./core/camera"; import MouseCaptor from "./core/captors/mouse"; diff --git a/src/utils/animate.ts b/src/utils/animate.ts index 7ad837487..af6968353 100644 --- a/src/utils/animate.ts +++ b/src/utils/animate.ts @@ -5,7 +5,7 @@ * Handy helper functions dealing with nodes & edges attributes animation. * @module */ -import Graph from "graphology"; +import Graph from "graphology-types"; import { PlainObject } from "../types"; import { cancelFrame, requestFrame } from "./index"; import easings from "./easings"; From 2531ff61a068e87734a7eb60935296e2cca64fea Mon Sep 17 00:00:00 2001 From: Alexis Jacomy Date: Wed, 25 May 2022 14:47:10 +0200 Subject: [PATCH 2/4] #1249 - Fixes hovered nodes layer not being cleared --- src/sigma.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sigma.ts b/src/sigma.ts index b0c9a6246..9537400a5 100644 --- a/src/sigma.ts +++ b/src/sigma.ts @@ -468,7 +468,8 @@ export default class Sigma extends TypedEventEmitter { this.hoveredNode = null; this.emit("leaveNode", { ...baseEvent, node }); - return this.scheduleHighlightedNodesRender(); + this.scheduleHighlightedNodesRender(); + return; } } @@ -1128,7 +1129,9 @@ export default class Sigma extends TypedEventEmitter { const data = this.nodeDataCache[node]; this.hoverNodePrograms[data.type].process(data, data.hidden, nodesPerPrograms[data.type]++); }); - // 4. Render: + // 4. Clear hovered nodes layer: + this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT); + // 5. Render: for (const type in this.hoverNodePrograms) { const program = this.hoverNodePrograms[type]; @@ -1486,7 +1489,7 @@ export default class Sigma extends TypedEventEmitter { clear(): this { this.webGLContexts.nodes.clear(this.webGLContexts.nodes.COLOR_BUFFER_BIT); this.webGLContexts.edges.clear(this.webGLContexts.edges.COLOR_BUFFER_BIT); - this.webGLContexts.hoverNodes.clear(this.webGLContexts.nodes.COLOR_BUFFER_BIT); + this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT); this.canvasContexts.labels.clearRect(0, 0, this.width, this.height); this.canvasContexts.hovers.clearRect(0, 0, this.width, this.height); this.canvasContexts.edgeLabels.clearRect(0, 0, this.width, this.height); From 4a91a8863fae0f30f44b4378fbc731c5c35068f2 Mon Sep 17 00:00:00 2001 From: Alexis Jacomy Date: Wed, 25 May 2022 15:20:26 +0200 Subject: [PATCH 3/4] Bump 2.3.1 --- CHANGELOG.md | 15 +++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec8f132ba..6e8c66a42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # sigma.js - changelog: +## 2.3.1 + +### Bug fixes + +- [#1230](https://github.com/jacomyal/sigma.js/pull/1230) - Updates broken link to graphology in README.md (thanks to @alexduhem) +- [#1236](https://github.com/jacomyal/sigma.js/issues/1236) - Fixes `#preventSigmaDefault` scoping +- [#1237](https://github.com/jacomyal/sigma.js/issues/1237) - Updates `pixelRatio` on resize +- [#1240](https://github.com/jacomyal/sigma.js/issues/1240) - Fixes click events for touch devices +- [#1244](https://github.com/jacomyal/sigma.js/issues/1244) - Stops relying on graphology for types (issue only partially fixed yet) +- [#1249](https://github.com/jacomyal/sigma.js/issues/1249) - Fixes hovered nodes layer not being cleared + +### Feature + +- [#1239](https://github.com/jacomyal/sigma.js/pull/1239) - Adds `getContainer` method to public API (thanks to @stefanprobst) + ## 2.3.0 ### Features diff --git a/package-lock.json b/package-lock.json index 670f90870..35010b535 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sigma", - "version": "2.3.0", + "version": "2.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "sigma", - "version": "2.3.0", + "version": "2.3.1", "license": "MIT", "dependencies": { "@yomguithereal/helpers": "^1.1.1", diff --git a/package.json b/package.json index f0c2c5b2a..febb5fb1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sigma", - "version": "2.3.0", + "version": "2.3.1", "description": "A JavaScript library aimed at visualizing graphs of thousands of nodes and edges.", "homepage": "https://www.sigmajs.org", "bugs": "http://github.com/jacomyal/sigma.js/issues", From 1a76bc15fe41339c0ae93b650b7e5eb634c9ce6d Mon Sep 17 00:00:00 2001 From: Kai Jauslin Date: Mon, 30 May 2022 10:22:42 +0200 Subject: [PATCH 4/4] fix: parse alpha value of hex format (#1251) --- src/utils/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index f6848a81e..76760058c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -260,8 +260,9 @@ export function parseColor(val: string): RGBAColor { g = parseInt(val.charAt(3) + val.charAt(4), 16); b = parseInt(val.charAt(5) + val.charAt(6), 16); } - - // TODO: parse hex with alpha? + if (val.length === 9) { + a = parseInt(val.charAt(7) + val.charAt(8), 16) / 255; + } } // Handling rgb notation