samcctan schrieb:
> Hi Holger,
>
> Thanks again for your help! Really!
>
> 1. You mentioned that in the function documentLoaded, I could access
> the currently loaded file with:
> svgDoc = appContent.contentDocument
> But I look through your zoomAndPan codes, there is another line
> before this:
>
> sdtsvgDocument=appContent.contentDocument
> svgRoot=sdtsvgDocument.documentElement
>
> I suppose the svgRoot is the same as the svgDoc above, am I right? If
> so, then should I include this documentElement?
svgRoot is the root element of the current document.
>
> Below is the snippet of my code which I modified after your help:
>
> *************************************************
> window.addEventListener("load", mtOnWindowLoad, false);
>
> document.addEventListener("mousemove", calculatePos, false);
> document.addEventListener("click", reading, false);
>
> function mtOnWindowLoad(){
> appContent = window.document.getElementById("content");
> if (appContent)
> appContent.addEventListener("load", documentLoaded, true);
> }
>
> function documentLoaded(){
> sdtsvgDocument = appContent.contentDocument;
> svgDOM = sdtsvgDocument.documentElement;
> var cType = sdtsvgDocument.contentType;
> if (cType == "image/svg+xml") {
> parseSVGFile(svgDOM);
> } else {
> alert("Not a SVG");
> }
>
> function parseSVGFile (svgDOM) {
> var path = svgDOM.getElementsByTagName('path');
> for (var z = 0; z < path.length; z++) {
> if (path[z].getAttribute('id') == 'xAxis') {
> var xAxis = path[z].getAttribute('d');
> var txt = xAxis;
> num = txt.split(" ")[1];
> }
> }
> (...... all other codes.....)
> }
>
> function getMousePosition(event) {
>
> var posX = 0;
> var posY = 0;
>
> posX = event.clientX + document.body.scrollLeft;
> posY = event.clientY + document.body.scrollTop;
>
> var position = new Array(2);
> position[0] = posX;
> position[1] = posY;
>
> return position;
> }
>
> function calculatePos (event) {
> var mousePosition = getMousePosition(event);
> checkAreaIn(mousePosition);
> }
>
> function checkAreaIn(mousePosition) {
> mx = mousePosition[0];
> my = mousePosition[1];
>
> var offsetX = 17;
> var offsetY = 40;
>
> var XCanva = canvaX + offsetX;
> var X2Canva = canvaWidth + offsetX;
> var YCanva = canvaY + offsetY;
> var Y2Canva = canvaHeight + offsetY;
>
> window.status = "X= " + mx + " Y= " + my;
>
> if (mx > XCanva && mx < X2Canva && my > YCanva && my < Y2Canva) {
> readAbtGraph();
> } else {
> }
> }
> (.... all other codes....)
> }
> ***************************************************
>
> 2. As above, I used one of the
> posX = event.clientX + document.body.scrollLeft
>
> It is working before that, when I am reading svg file on a local
> machine and I tried on a simple html file (Javascript embedded in
> html) only with this code, it works as well. But why when I included
> only this mouse position codes in overlay.js and place it in a plug
> in, it doesn't work (nothing shown in status bar). But when I delete
> the end part and left: posX=event.clientX, it works (mouse position
> shown in status bar). DO you have any clue why this happen? Why
> document.body.scrollLeft can't be used in this case?
in this context, document is your xul document, not the svg document,
besides there is no body property in SVG Documents.
>
> 3. Logically I think I understand how this will work. But there is
> one question. If I wish to start my plugin only when the svg File is
> displayed in a new page (such as when we right click and "view SVG"),
> and not when a svg File embedded in a webpage. If you know what I
> mean? Can this be done?
the code you have so far does not handle any embeded SVG , it only
handles standalone documents.
your "PlugIn" is loaded at the start of the browser, and listens to load
events of documents,
so you can find out if an svg document got loaded and then you can take
the appropriate action.
>
> 4. This might be a silly question: I suppose I need to uninstall the
> firefox I have in my machine (firefox 1.0.6) before I install this
> alpha version from the link you gave to me. Am I right?
you might want to try this build, you dont have to install anything,(
keep your old installation)
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/contrib/latest-trunk/firefox-win32-svg-GDI.zip
just unzip it , and then in the bin/ folder there is the firefox.exe,
you can start it by just double clicking, no need to install anything.
just make sure no other firefox instance is running !
>
> 5. Lastly, just for curiousity, why is this approach only works in
> the version you mentioned, but not for the previous version?
because the next version of firefox will have native SVG support...
and there is no way firefox can comunicate with ASV ( contentDocument
does not work ! )
>
> I am really sorry if I ask too many questions. Hope you don't mind.
> Really sorry and thanks a lot for your help.
>
> S.
>
>
>
>
> -----
> To unsubscribe send a message to:
> [EMAIL PROTECTED]
> -or-
> visit http://groups.yahoo.com/group/svg-developers and click "edit my
> membership"
> ----
>
>
>
> SPONSORED LINKS
> Format
> <http://groups.yahoo.com/gads?t=ms&k=Format&w1=Format&w2=Data&w3=Svg&w4=Computer+internet&c=4&s=54&.sig=mss7sdgKqA6g3kZdQDUPlQ>
>
> Data
> <http://groups.yahoo.com/gads?t=ms&k=Data&w1=Format&w2=Data&w3=Svg&w4=Computer+internet&c=4&s=54&.sig=ttc_I3xolnfTeJBwCQHoKw>
>
> Svg
> <http://groups.yahoo.com/gads?t=ms&k=Svg&w1=Format&w2=Data&w3=Svg&w4=Computer+internet&c=4&s=54&.sig=gA0PTaYLRsHWXst1hwGTHA>
>
>
> Computer internet
> <http://groups.yahoo.com/gads?t=ms&k=Computer+internet&w1=Format&w2=Data&w3=Svg&w4=Computer+internet&c=4&s=54&.sig=keDwWSMSTIcBlx1nGDfqmg>
>
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
> * Visit your group "svg-developers
> <http://groups.yahoo.com/group/svg-developers>" on the web.
>
> * To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12h4mp0eg/M=362131.6882499.7825260.1510227/D=groups/S=1706030389:TM/Y=YAHOO/EXP=1124302637/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~->
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/