Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
HTML5 SVG Library
This library enables to create vector image (SVG) authoring application like Illustrator.
In concrete, this library may be useful to implement the following features.
The 1st, ArtSVG class is required.
<script type="text/javascript" src="ArtSVG.js"></script>
or,
<script type="text/javascript" src="ArtSVG.min.js"></script>
Next, the instance of ArtSVG must be created.
ArtSVG constructor requires 4 arguments.
for example,
var svg = document.querySelector('svg');
var container = svg.parentNode;
var width = 600; // px
var height = 600; // px
// Create the instance of ArtSVG
var artSVG = new ArtSVG(container, svg, width, height);
This library has the following modes.
console.log(ArtSVG.Mode.SELECT); // for selecting SVGElement
console.log(ArtSVG.Mode.DRAW); // for drawing SVGElement
// Getter
var mode = artSVG.getMode(); // -> ArtSVG.Mode.SELECT is the default mode
// Setter
artSVG.setMode(ArtSVG.Mode.DRAW); // -> change mode to ArtSVG.Mode.DRAW
// Change mode
artSVG.setMode(ArtSVG.Mode.DRAW);
// Select Drawer
artSVG.setDrawerType(Drawer.Type.PATH); // Draw Path
artSVG.setDrawerType(Drawer.Type.RECTANGLE); // Draw Rectangle
artSVG.setDrawerType(Drawer.Type.SQUARE); // Draw Square
artSVG.setDrawerType(Drawer.Type.CIRCLE); // Draw Circle
artSVG.setDrawerType(Drawer.Type.ELLIPSE); // Draw Ellipse
artSVG.setDrawerType(Drawer.Type.LINE); // Draw Line
artSVG.setDrawerType(Drawer.Type.TEXT); // Draw Text
document.querySelector('[type="file"]').addEventListener('change', function(event) {
var file = event.currentTarget.files[0];
if (!(file instanceof File)) {
window.alert('Please upload file.');
} else if (file.type.indexOf('image') === -1) {
window.alert('Please upload image file.');
} else {
var reader = new FileReader();
reader.onload = function() {
artSVG.drawImage(reader.result, 0, 0);
};
reader.readAsDataURL(file);
}
}, false);
var result = artSVG.undo();
if (!result) {
// Cannot Undo
}
var result = artSVG.redo();
if (!result) {
// Cannot Redo
}
artSVG.clear();
It is required that color string (hex, rgb, hsl, rgba, hsla ...etc) is designated for fill style and stroke style.
artSVG.setFill('rgba(0, 0, 255, 1.0)'); // Fill style
artSVG.setStroke('rgba(255, 0, 0, 1.0)'); // Stroke style
var strokeWidth = 3; // This value is greater than 0
artSVG.setStrokeWidth(strokeWidth);
var lineCap = 'round'; // one of 'butt', 'round', 'square'
artSVG.setStrokeLinecap(lineCap);
var lineJoin = 'round'; // one of 'miter', 'round', 'bevel'
artSVG.setStrokeLinejoin(lineJoin);
artSVG.setFontFamily('Helvetica');
artSVG.setFontSize('16px');
artSVG.setFontStyle('italic');
artSVG.setFontWeight('bold');
FAQs
HTML5 SVG Library
The npm package art-svg receives a total of 0 weekly downloads. As such, art-svg popularity was classified as not popular.
We found that art-svg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.