Changed basic structure for improved integration and customization, introduces global svgEditor object
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1456 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
750e6456b3
commit
85a7f57e78
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@
|
|||
* Copyright(c) 2009 Narendra Sisodya
|
||||
*
|
||||
*/
|
||||
var put_locale = function(svgCanvas, given_param, good_langs){
|
||||
var put_locale = function(svgEditor, given_param, good_langs){
|
||||
var lang_param;
|
||||
|
||||
if(given_param) {
|
||||
|
@ -21,7 +21,6 @@ var put_locale = function(svgCanvas, given_param, good_langs){
|
|||
if (lang_param == "")
|
||||
return;
|
||||
}
|
||||
lang_param = String(lang_param);
|
||||
|
||||
// Set to English if language is not in list of good langs
|
||||
if($.inArray(lang_param, good_langs) == -1) {
|
||||
|
@ -36,7 +35,7 @@ var put_locale = function(svgCanvas, given_param, good_langs){
|
|||
|
||||
var processFile = function(data){
|
||||
var LangData = eval(data), js_strings;
|
||||
var more = svgCanvas.runExtensions("addLangData", lang_param, true);
|
||||
var more = svgEditor.canvas.runExtensions("addLangData", lang_param, true);
|
||||
$.each(more, function(i, m) {
|
||||
if(m.data) {
|
||||
LangData = $.merge(LangData, m.data);
|
||||
|
@ -61,7 +60,7 @@ var put_locale = function(svgCanvas, given_param, good_langs){
|
|||
js_strings = data.js_strings;
|
||||
}
|
||||
});
|
||||
svgCanvas.setLang(lang_param, js_strings);
|
||||
svgEditor.setLang(lang_param, js_strings);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
|
|
5756
editor/svg-editor.js
5756
editor/svg-editor.js
File diff suppressed because it is too large
Load Diff
|
@ -82,7 +82,7 @@ if(window.opera) {
|
|||
}());
|
||||
|
||||
|
||||
function SvgCanvas(container)
|
||||
$.SvgCanvas = function(container, config)
|
||||
{
|
||||
var isOpera = !!window.opera,
|
||||
isWebkit = navigator.userAgent.indexOf("AppleWebKit") != -1,
|
||||
|
@ -169,6 +169,10 @@ var isOpera = !!window.opera,
|
|||
"pathCtrlPtTooltip":"Drag control point to adjust curve properties"
|
||||
},
|
||||
|
||||
curConfig = {
|
||||
show_outside_canvas: true
|
||||
},
|
||||
|
||||
toXml = function(str) {
|
||||
return $('<p/>').text(str).html();
|
||||
},
|
||||
|
@ -177,6 +181,10 @@ var isOpera = !!window.opera,
|
|||
return $('<p/>').html(str).text();
|
||||
};
|
||||
|
||||
if(config) {
|
||||
$.extend(curConfig, config);
|
||||
}
|
||||
|
||||
var unit_types = {'em':0,'ex':0,'px':1,'cm':35.43307,'mm':3.543307,'in':90,'pt':1.25,'pc':15,'%':0};
|
||||
|
||||
// These command objects are used for the Undo/Redo stack
|
||||
|
@ -992,7 +1000,7 @@ function BatchCommand(text) {
|
|||
height: 480,
|
||||
x: 640,
|
||||
y: 480,
|
||||
overflow: 'visible',
|
||||
overflow: curConfig.show_outside_canvas?'visible':'hidden',
|
||||
xmlns: svgns,
|
||||
"xmlns:se": se_ns,
|
||||
"xmlns:xlink": xlinkns
|
||||
|
@ -5749,7 +5757,7 @@ function BatchCommand(text) {
|
|||
|
||||
var attrs = {
|
||||
id: 'svgcontent',
|
||||
overflow: 'visible'
|
||||
overflow: curConfig.show_outside_canvas?'visible':'hidden'
|
||||
};
|
||||
|
||||
// determine proper size
|
||||
|
@ -8105,19 +8113,13 @@ function BatchCommand(text) {
|
|||
this.setUiStrings = function(strs) {
|
||||
$.extend(uiStrings, strs);
|
||||
}
|
||||
|
||||
this.setConfig = function(opts) {
|
||||
$.extend(curConfig, opts);
|
||||
}
|
||||
|
||||
this.clear();
|
||||
|
||||
this.ready = function(cb) {
|
||||
this.callback = cb;
|
||||
}
|
||||
|
||||
this.runCallback = function() {
|
||||
if(this.callback) {
|
||||
this.callback();
|
||||
}
|
||||
}
|
||||
|
||||
function getElem(id) {
|
||||
if(svgroot.querySelector) {
|
||||
// querySelector lookup
|
||||
|
|
Loading…
Reference in New Issue