From 7ec9326ce00d08f9d957981f2edff6df26f24a28 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期四, 26 九月 2024 13:25:02 +0800
Subject: [PATCH] 修改
---
web/public/SVGOrigin/Method-Draw-master/editor/src/embedapi.js | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/web/public/SVGOrigin/Method-Draw-master/editor/src/embedapi.js b/web/public/SVGOrigin/Method-Draw-master/editor/src/embedapi.js
index 923ee78..a5ae78d 100644
--- a/web/public/SVGOrigin/Method-Draw-master/editor/src/embedapi.js
+++ b/web/public/SVGOrigin/Method-Draw-master/editor/src/embedapi.js
@@ -3,9 +3,9 @@
//initialize communication
this.frame = frame;
this.stack = []; //callback stack
-
+
var editapi = this;
-
+
window.addEventListener("message", function(e){
if(e.data.substr(0,5) == "ERROR"){
editapi.stack.splice(0,1)[0](e.data,"error")
@@ -48,9 +48,9 @@
}
})
-Everything is done with the same API as the real svg-edit,
+Everything is done with the same API as the real svg-edit,
and all documentation is unchanged. The only difference is
-when handling returns, the callback notation is used instead.
+when handling returns, the callback notation is used instead.
var blah = new embedded_svg_edit(window.frames['svgedit']);
blah.clearSelection("woot","blah",1337,[1,2,3,4,5,"moo"],-42,{a: "tree",b:6, c: 9})(function(){console.log("GET DATA",arguments)})
@@ -64,13 +64,13 @@
this.encode = embedded_svg_edit.encode;
//List of functions extracted with this:
//Run in firebug on http://svg-edit.googlecode.com/svn/trunk/docs/files/svgcanvas-js.html
-
+
//for(var i=0,q=[],f = document.querySelectorAll("div.CFunction h3.CTitle a");i<f.length;i++){q.push(f[i].name)};q
//var functions = ["clearSelection", "addToSelection", "removeFromSelection", "open", "save", "getSvgString", "setSvgString",
//"createLayer", "deleteCurrentLayer", "setCurrentLayer", "renameCurrentLayer", "setCurrentLayerPosition", "setLayerVisibility",
//"moveSelectedToLayer", "clear"];
-
-
+
+
//Newer, well, it extracts things that aren't documented as well. All functions accessible through the normal thingy can now be accessed though the API
//var l=[];for(var i in svgCanvas){if(typeof svgCanvas[i] == "function"){l.push(i)}};
//run in svgedit itself
@@ -89,7 +89,7 @@
"getStrokedBBox", "getVisibleElements", "cycleElement", "getUndoStackSize", "getRedoStackSize", "getNextUndoCommandText",
"getNextRedoCommandText", "undo", "redo", "cloneSelectedElements", "alignSelectedElements", "getZoom", "getVersion",
"setIconSize", "setLang", "setCustomHandlers"];
-
+
//TODO: rewrite the following, it's pretty scary.
for(var i = 0; i < functions.length; i++){
this[functions[i]] = (function(d){
@@ -99,7 +99,7 @@
args.push(arguments[g]);
}
var cbid = t.send(d,args, function(){}) //the callback (currently it's nothing, but will be set later
-
+
return function(newcallback){
t.callbacks[cbid] = newcallback; //set callback
}
@@ -128,7 +128,7 @@
//simple partial JSON encoder implementation
if(window.JSON && JSON.stringify) return JSON.stringify(obj);
var enc = arguments.callee; //for purposes of recursion
-
+
if(typeof obj == "boolean" || typeof obj == "number"){
return obj+'' //should work...
}else if(typeof obj == "string"){
--
Gitblit v1.9.1