t : String,
p : VisiblePieceId,
}
-
#[post("/_/api/grab", format="json", data="<form>")]
#[throws(RE)]
-fn api(form : Json<ApiGrab>) -> impl response::Responder<'static> {
+fn api_grab(form : Json<ApiGrab>) -> impl response::Responder<'static> {
+ eprintln!("API {:?}", &form);
+ ""
+}
+
+#[derive(Debug,Serialize,Deserialize)]
+struct ApiMove {
+ t : String,
+ p : VisiblePieceId,
+ l : Pos,
+}
+#[post("/_/api/m", format="json", data="<form>")]
+#[throws(RE)]
+fn api_move(form : Json<ApiMove>) -> impl response::Responder<'static> {
eprintln!("API {:?}", &form);
""
}
session,
resource,
updates,
- api,
+ api_grab,
+ api_move,
])
.launch();
}
delt.setAttributeNS(null, "x", x);
delt.setAttributeNS(null, "y", y);
console.log(delt);
+ xhr_post_then('/_/api/m',JSON.stringify({
+ t : token,
+ p : delt.dataset.p,
+ l : [Math.round(x),Math.round(y)],
+ }), function(){});
}
}