Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
svg.select.js
Advanced tools
Readme
An extension of svg.js which allows to select elements with mouse
Note: Duo to naming conflicts the exported method was renamed from select()
to selectize()
.
For a demo see http://svgdotjs.github.io/svg.select.js/
Install svg.select.js
using bower:
bower install svg.select.js
Include the script after svg.js into your page
<script src="svg.js"></script>
<script src="svg.select.js"></script>
Select a rectangle using this simple piece of code:
<div id="myDrawing"></div>
var drawing = new SVG('myDrawing').size(500, 500);
drawing.rect(50,50).selectize()
Select
var draw = SVG('drawing');
var rect = draw.rect(100,100);
rect.selectize();
// or deepSelect
rect.selectize({deepSelect:true});
Unselect
rect.selectize(false);
// or deepSelect
rect.selectize(false, {deepSelect:true});
You can specify which points to be drawn (default all will be drawn)
The list can be an array of strings or a comma separated list / string, representing each position, in correspondence with the classes:
lt
- left toprt
- right toprb
- right bottomlb
- left bottomt
- topr
- rightb
- bottoml
- leftExample of drawing only top
and right
points:
rect.selectize({
points: ['t', 'r'] // or 't, r'
})
There is also an extra option called pointsExclude
which can be a list of points to be excluded from the points
list.
So let's say that you need all the points except top
and right
:
rect.selectize({
pointsExclude: ['t', 'r'] // or 't, r'
})
You can style the selection with the classes
svg_select_boundingRect
svg_select_points
svg_select_points_lt
- left topsvg_select_points_rt
- right topsvg_select_points_rb
- right bottomsvg_select_points_lb
- left bottomsvg_select_points_t
- topsvg_select_points_r
- rightsvg_select_points_b
- bottomsvg_select_points_l
- leftsvg_select_points_rot
- rotation pointsvg_select_points_point
- deepSelect points['lt', 'rt', 'rb', 'lb', 't', 'r', 'b', 'l']
)[]
)svg_select_boundingRect
)svg_select_points
)pointType: 'circle'
or size of a rect for pointType: 'rect'
(default 7
)true
)false
)circle
or rect
or function (see functions for drawing circle or rect points) (default circle
)FAQs
An extension of svg.js which allows to select elements with mouse
The npm package svg.select.js receives a total of 1,147,011 weekly downloads. As such, svg.select.js popularity was classified as popular.
We found that svg.select.js 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.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.