1 |
w |
1.1 |
<?xml version="1.0"?>
|
2 |
|
|
<bindings xmlns="http://www.mozilla.org/xbl">
|
3 |
|
|
<binding id="simple-drag">
|
4 |
|
|
<implementation>
|
5 |
|
|
<field name="dragCX">0</field>
|
6 |
|
|
<field name="dragCY">0</field>
|
7 |
|
|
<method name="dragStart" type="application/x-javascript">
|
8 |
|
|
<parameter name="e" />
|
9 |
|
|
<body>
|
10 |
|
|
<![CDATA[
|
11 |
|
|
this.className += ' DRAGING';
|
12 |
|
|
this.dragCX = e.clientX - this.offsetLeft;
|
13 |
|
|
this.dragCY = e.clientY - this.offsetTop;
|
14 |
|
|
this.addEventListener ('mousemove', this.draging, false);
|
15 |
|
|
]]>
|
16 |
|
|
</body>
|
17 |
|
|
</method>
|
18 |
|
|
<method name="dragExit" type="application/x-javascript">
|
19 |
|
|
<body>
|
20 |
|
|
<![CDATA[
|
21 |
|
|
this.className = this.className.replace (/ DRAGING/, '');
|
22 |
|
|
this.removeEventListener ('mousemove', this.draging, false);
|
23 |
|
|
]]>
|
24 |
|
|
</body>
|
25 |
|
|
</method>
|
26 |
|
|
<method name="draging" type="application/x-javascript">
|
27 |
|
|
<parameter name="e" />
|
28 |
|
|
<body>
|
29 |
|
|
<![CDATA[
|
30 |
|
|
this.style.left = (e.clientX - this.dragCX > 0 ?
|
31 |
|
|
e.clientX - this.dragCX : 0) + 'px';
|
32 |
|
|
this.style.top = (e.clientY - this.dragCY > 0 ?
|
33 |
|
|
e.clientY - this.dragCY : 0) + 'px';
|
34 |
|
|
]]>
|
35 |
|
|
</body>
|
36 |
|
|
</method>
|
37 |
|
|
<constructor type="application/x-javascript">
|
38 |
|
|
<![CDATA[
|
39 |
|
|
this.className += ' DRAGABLE';
|
40 |
|
|
this.addEventListener ('mousedown', this.dragStart, false);
|
41 |
|
|
this.addEventListener ('mouseup', this.dragExit, false);
|
42 |
|
|
]]>
|
43 |
|
|
</constructor>
|
44 |
|
|
</implementation>
|
45 |
|
|
</binding>
|
46 |
|
|
</bindings>
|
47 |
|
|
<!-- ***** BEGIN LICENSE BLOCK *****
|
48 |
|
|
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
49 |
|
|
-
|
50 |
|
|
- The contents of this file are subject to the Mozilla Public License Version
|
51 |
|
|
- 1.1 (the "License"); you may not use this file except in compliance with
|
52 |
|
|
- the License. You may obtain a copy of the License at
|
53 |
|
|
- <http://www.mozilla.org/MPL/>
|
54 |
|
|
-
|
55 |
|
|
- Software distributed under the License is distributed on an "AS IS" basis,
|
56 |
|
|
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
57 |
|
|
- for the specific language governing rights and limitations under the
|
58 |
|
|
- License.
|
59 |
|
|
-
|
60 |
|
|
- The Original Code is SuikaWiki code.
|
61 |
|
|
-
|
62 |
|
|
- The Initial Developer of the Original Code is Wakaba.
|
63 |
|
|
- Portions created by the Initial Developer are Copyright (C) 2003
|
64 |
|
|
- the Initial Developer. All Rights Reserved.
|
65 |
|
|
-
|
66 |
|
|
- Contributor(s):
|
67 |
|
|
- Wakaba <w@suika.fam.cx>
|
68 |
|
|
-
|
69 |
|
|
- Alternatively, the contents of this file may be used under the terms of
|
70 |
|
|
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
71 |
|
|
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
72 |
|
|
- in which case the provisions of the GPL or the LGPL are applicable instead
|
73 |
|
|
- of those above. If you wish to allow use of your version of this file only
|
74 |
|
|
- under the terms of either the GPL or the LGPL, and not to allow others to
|
75 |
|
|
- use your version of this file under the terms of the MPL, indicate your
|
76 |
|
|
- decision by deleting the provisions above and replace them with the notice
|
77 |
|
|
- and other provisions required by the LGPL or the GPL. If you do not delete
|
78 |
|
|
- the provisions above, a recipient may use your version of this file under
|
79 |
|
|
- the terms of any one of the MPL, the GPL or the LGPL.
|
80 |
|
|
-
|
81 |
|
|
- ***** END LICENSE BLOCK ***** -->
|
82 |
|
|
<!-- See also <http://niigata.cool.ne.jp/wakaba2001/temp/mozilla/drag-xbl-note.ja.html> -->
|