Fixed issue 680, added Raphael icons to path lib (thanks Christian)
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1735 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
fb653705d6
commit
a54a874ffd
|
@ -31,7 +31,9 @@ svgEditor.addExtension("shapes", function() {
|
|||
electronics: 'Electronics',
|
||||
math: 'Mathematical',
|
||||
music: 'Music',
|
||||
misc: 'Miscellaneous'
|
||||
misc: 'Miscellaneous',
|
||||
raphael_1: 'raphaeljs.com set 1',
|
||||
raphael_2: 'raphaeljs.com set 2'
|
||||
};
|
||||
|
||||
var library = {
|
||||
|
@ -88,9 +90,12 @@ svgEditor.addExtension("shapes", function() {
|
|||
|
||||
if(!lib) {
|
||||
$('#shape_buttons').html('Loading...');
|
||||
console.log('extensions/shapelib/' + cat_id + '.json');
|
||||
$.getJSON('extensions/shapelib/' + cat_id + '.json', function(result, textStatus) {
|
||||
cur_lib = library[cat_id] = {
|
||||
data: result.data
|
||||
data: result.data,
|
||||
size: result.size,
|
||||
fill: result.fill
|
||||
}
|
||||
makeButtons(cat_id, result);
|
||||
loadIcons();
|
||||
|
@ -104,9 +109,15 @@ svgEditor.addExtension("shapes", function() {
|
|||
}
|
||||
|
||||
function makeButtons(cat, shapes) {
|
||||
|
||||
var size = cur_lib.size || 300;
|
||||
var fill = cur_lib.fill || false;
|
||||
var off = size * .05;
|
||||
var vb = [-off, -off, size + off*2, size + off*2].join(' ');
|
||||
var stroke = fill ? 0: (size/30);
|
||||
console.log(vb);
|
||||
|
||||
var shape_icon = new DOMParser().parseFromString(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="-10 -10 320 320"><path fill="none" stroke="#000000" stroke-width="10" /><\/svg><\/svg>',
|
||||
'<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="' + vb + '"><path fill="'+(fill?'#333':'none')+'" stroke="#000000" stroke-width="' + stroke + '" /><\/svg><\/svg>',
|
||||
'text/xml');
|
||||
|
||||
var width = 24;
|
||||
|
|
|
@ -313,7 +313,7 @@ $(function() {
|
|||
|
||||
// Without cloning, Firefox will make another GET request.
|
||||
// With cloning, causes issue in Opera/Win/Non-EN
|
||||
// if(!isOpera) svg = svg.cloneNode(true);
|
||||
if(!isOpera) svg = svg.cloneNode(true);
|
||||
|
||||
svgroot.appendChild(svg);
|
||||
|
||||
|
|
Loading…
Reference in New Issue