Socket
Socket
Sign inDemoInstall

vega-scenegraph

Package Overview
Dependencies
Maintainers
2
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-scenegraph - npm Package Compare versions

Comparing version 1.0.18 to 1.1.0

9

package.json
{
"name": "vega-scenegraph",
"version": "1.0.18",
"version": "1.1.0",
"description": "Vega scenegraph and renderers.",

@@ -13,2 +13,9 @@ "repository": {

},
"contributors": [{
"name": "Arvind Satyanarayan",
"url": "http://arvindsatya.com"
}, {
"name": "Emily Gu",
"url": "https://github.com/emilygu"
}],
"license": "BSD-3-Clause",

@@ -15,0 +22,0 @@ "dependencies": {

@@ -1,2 +0,4 @@

var util = require('./util');
var util = require('./util'),
parse = require('../../../path/parse'),
render = require('../../../path/render');

@@ -66,2 +68,8 @@ var sqrt3 = Math.sqrt(3),

g.lineTo(x-rx, y+ry);
break;
// custom shape
default:
var pathArray = resize(parse(o.shape), size);
render(g, pathArray, x, y);
}

@@ -71,2 +79,15 @@ g.closePath();

// Scale custom shapes (defined within a unit square) by given size.
function resize(path, size) {
var sz = Math.sqrt(size),
i, n, j, m, curr;
for (i=0, n=path.length; i<n; ++i) {
for (curr=path[i], j=1, m=curr.length; j<m; ++j) {
curr[j] *= sz;
}
}
return path;
}
module.exports = {

@@ -73,0 +94,0 @@ draw: util.drawAll(path),

8

src/render/svg/marks.js
var text = require('../../util/text'),
SVG = require('../../util/svg'),
symbolTypes = SVG.symbolTypes,
textAlign = SVG.textAlign,

@@ -112,4 +113,7 @@ path = SVG.path;

attr: function(emit, o) {
var pathStr = !o.shape || symbolTypes[o.shape] ?
path.symbol(o) : path.resize(o.shape, o.size);
emit('transform', translateItem(o));
emit('d', path.symbol(o));
emit('d', pathStr);
}

@@ -136,3 +140,3 @@ },

emit('text-anchor', textAlign[o.align] || 'start');
if (a) {

@@ -139,0 +143,0 @@ t = translate(x, y) + ' rotate('+a+')';

@@ -1,2 +0,4 @@

var d3_svg = require('d3').svg;
var dl = require('datalib'),
d3_svg = require('d3').svg,
parse = require('../path/parse');

@@ -36,4 +38,25 @@ function x(o) { return o.x || 0; }

(items);
},
resize: function(pathStr, size) {
var path = parse(pathStr),
newPath = '',
command, current, index, i, n, j, m;
size = Math.sqrt(size);
for (i=0, n=path.length; i<n; ++i) {
for (command=path[i], j=0, m=command.length; j<m; ++j) {
if (command[j] === 'Z') break;
if ((current = +command[j]) === current) {
// if number, need to resize
index = pathStr.indexOf(current);
newPath += pathStr.substring(0, index) + (current * size);
pathStr = pathStr.substring(index + (current+'').length);
}
}
}
return newPath + 'Z';
}
},
symbolTypes: dl.toMap(d3_svg.symbolTypes),
textAlign: {

@@ -40,0 +63,0 @@ 'left': 'start',

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc