cjolif 01/10/26 08:41:51
Modified: xdocs scriptIntro.xml
Log:
modify documentation according to new batikMusic.svg sample.
Revision Changes Path
1.5 +18 -25 xml-batik/xdocs/scriptIntro.xml
Index: scriptIntro.xml
===================================================================
RCS file: /home/cvs/xml-batik/xdocs/scriptIntro.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- scriptIntro.xml 2001/10/26 11:45:40 1.4
+++ scriptIntro.xml 2001/10/26 15:41:51 1.5
@@ -11,7 +11,7 @@
<!-- ========================================================================= -->
<!-- author [EMAIL PROTECTED] -->
-<!-- version $Id: scriptIntro.xml,v 1.4 2001/10/26 11:45:40 cjolif Exp $ -->
+<!-- version $Id: scriptIntro.xml,v 1.5 2001/10/26 15:41:51 cjolif Exp $ -->
<!-- ========================================================================= -->
<document>
<header>
@@ -90,42 +90,35 @@
midiChannel.programChange(0)
function down(evt) {
- target = evt.currentTarget
+ target = evt.target.parentElement
midiChannel.noteOn(target.id, 64)
lastId = target.id
}
function drag(evt) {
if (lastId != -1) {
- target = evt.currentTarget
+ target = evt.target.parentElement
midiChannel.noteOn(target.id, 64)
lastId = target.id
}
}
</script>
- <rect id="blank" x="0" y="0" width="10" height="60"/>
- <rect id="black" x="0" y="0" width="6" height="33"/>
+ <rect onmousedown="down(evt)" onmouseover="drag(evt)"
+ id="blank" x="0" y="0" width="10" height="60"/>
+ <rect onmousedown="down(evt)" onmouseover="drag(evt)"
+ id="black" x="0" y="0" width="6" height="33"/>
</defs>
<g>
- <use onmousedown="down(evt)" onmouseover="drag(evt)" id="24"
- xlink:href="#blank"/>
- <use onmousedown="down(evt)" onmouseover="drag(evt)" id="26" x="10"
- xlink:href="#blank"/>
- <use onmousedown="down(evt)" onmouseover="drag(evt)" id="25" x="7"
- xlink:href="#black"/>
- <use onmousedown="down(evt)" onmouseover="drag(evt)" id="28" x="20"
- xlink:href="#blank"/>
- <use onmousedown="down(evt)" onmouseover="drag(evt)" id="27" x="17"
- xlink:href="#black"/>
+ <use id="24" xlink:href="#blank"/>
+ <use id="26" x="10" xlink:href="#blank"/>
+ <use id="25" x="7" xlink:href="#black"/>
+ <use id="28" x="20" xlink:href="#blank"/>
+ <use id="27" x="17" xlink:href="#black"/>
<!-- some other keys as in batikMusic.svg from the distribution -->
- <use onmousedown="down(evt)" onmouseover="drag(evt)" id="93" x="400"
- xlink:href="#blank"/>
- <use onmousedown="down(evt)" onmouseover="drag(evt)" id="92" x="397"
- xlink:href="#black"/>
- <use onmousedown="down(evt)" onmouseover="drag(evt)" id="95" x="410"
- xlink:href="#blank"/>
- <use onmousedown="down(evt)" onmouseover="drag(evt)" id="94" x="407"
- xlink:href="#black"/>
+ <use id="93" x="400" xlink:href="#blank"/>
+ <use id="92" x="397" xlink:href="#black"/>
+ <use id="95" x="410" xlink:href="#blank"/>
+ <use id="94" x="407" xlink:href="#black"/>
</g>
</svg></source>
<p>
@@ -142,8 +135,8 @@
</p>
<p>
When the user presses the mouse down on a piano key, the <code>down</code>
function is called,
- it gets the SVG element corresponding to the key on which the event listener
as been registered
- (<code>evt.currentTarget</code>) and plays the note corresponding to that key
by retrieving it
+ it gets the SVG element corresponding to the key on which the mouse button has
been pressed
+ and plays the note corresponding to that key by retrieving it
from the ID set on the element (<code>target.id</code>).
A similar job is done in the <code>drag</code> function.
</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]