chiark
/
gitweb
/
~ianmdlvl
/
otter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6140468
)
script: break out piece_xy
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 25 Mar 2021 16:38:13 +0000
(16:38 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 25 Mar 2021 16:38:13 +0000
(16:38 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts
patch
|
blob
|
history
diff --git
a/templates/script.ts
b/templates/script.ts
index 96b8d1eb99f71968e3e88eb47e97119918f90ef9..2360b2f955c3f9d45a75b684dbe83427cc28869f 100644
(file)
--- a/
templates/script.ts
+++ b/
templates/script.ts
@@
-676,11
+676,17
@@
var dcy : number | null;
const DRAGTHRESH = 5;
+function piece_xy(p: PieceInfo): [number, number] {
+ return [ parseFloat(p.uelem.getAttributeNS(null,"x")!),
+ parseFloat(p.uelem.getAttributeNS(null,"y")!) ];
+}
+
function drag_add_piece(piece: PieceId, p: PieceInfo) {
+ let [dox, doy] = piece_xy(p);
drag_pieces.push({
piece: piece,
- dox:
parseFloat(p.uelem.getAttributeNS(null,"x")!)
,
- doy:
parseFloat(p.uelem.getAttributeNS(null,"y")!)
,
+ dox:
dox
,
+ doy:
doy
,
});
}