@data-navigator/inspector 1.1.1 → 1.2.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/package.json +1 -1
- package/src/inspector.js +9 -2
package/package.json
CHANGED
package/src/inspector.js
CHANGED
|
@@ -153,8 +153,9 @@ export function Inspector({
|
|
|
153
153
|
if (!rootEl.id) rootEl.id = rootId;
|
|
154
154
|
|
|
155
155
|
// Build the graph SVG
|
|
156
|
-
const
|
|
157
|
-
const
|
|
156
|
+
const sizeIsObject = size !== null && typeof size === 'object';
|
|
157
|
+
const graphWidth = sizeIsObject ? size.width : mode === 'tree' ? size * 2 : size;
|
|
158
|
+
const graphHeight = sizeIsObject ? size.height : mode === 'tree' ? Math.round(size * 1.5) : size;
|
|
158
159
|
const nodeArray = convertToArray(structure.nodes, nodeInclusions);
|
|
159
160
|
const linkArray = convertToArray(structure.edges, [], edgeExclusions);
|
|
160
161
|
const idPrefix = rootId + '-';
|
|
@@ -173,6 +174,12 @@ export function Inspector({
|
|
|
173
174
|
? TreeGraph({ nodes: nodeArray, links: linkArray }, { ...graphOptions, dimensions: structure.dimensions })
|
|
174
175
|
: ForceGraph({ nodes: nodeArray, links: linkArray }, graphOptions);
|
|
175
176
|
|
|
177
|
+
// When explicit pixel dimensions are given, remove the auto-scaling inline style so the
|
|
178
|
+
// SVG renders at exactly the specified size rather than scaling to container width.
|
|
179
|
+
if (sizeIsObject) {
|
|
180
|
+
graph.style.cssText = 'display: block;';
|
|
181
|
+
}
|
|
182
|
+
|
|
176
183
|
// Create wrapper structure
|
|
177
184
|
const wrapperEl = document.createElement('div');
|
|
178
185
|
wrapperEl.className = 'dn-inspector-wrapper';
|