mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-25 16:58:06 +08:00
mac add touch
This commit is contained in:
parent
bafd18685b
commit
78c0521e74
@ -102,7 +102,7 @@ func (web *WEB) Trans(m *ctx.Message, key string, hand func(*ctx.Message, *ctx.C
|
||||
msg.Add("option", k, v)
|
||||
}
|
||||
|
||||
msg.Log("cmd", "%s [] %v", key, msg.Meta["option"])
|
||||
// msg.Log("cmd", "%s [] %v", key, msg.Meta["option"])
|
||||
msg.Put("option", "request", r).Put("option", "response", w)
|
||||
hand(msg, msg.Target(), msg.Option("path"))
|
||||
|
||||
@ -125,8 +125,9 @@ func (web *WEB) Trans(m *ctx.Message, key string, hand func(*ctx.Message, *ctx.C
|
||||
|
||||
// }}}
|
||||
func (web *WEB) ServeHTTP(w http.ResponseWriter, r *http.Request) { // {{{
|
||||
m := web.Message().Log("info", "").Log("info", "%v %s %s", r.RemoteAddr, r.Method, r.URL)
|
||||
|
||||
m := web.Message()
|
||||
// .Log("info", "").Log("info", "%v %s %s", r.RemoteAddr, r.Method, r.URL)
|
||||
//
|
||||
if m.Confs("logheaders") {
|
||||
for k, v := range r.Header {
|
||||
m.Log("info", "%s: %v", k, v)
|
||||
|
@ -348,7 +348,6 @@ function action(event, which, group) {//{{{
|
||||
draw_history = JSON.parse(conf("config", "json"));
|
||||
refresh();
|
||||
break
|
||||
|
||||
default:
|
||||
if (!which || !group) {
|
||||
break
|
||||
@ -395,13 +394,10 @@ function draw_point(event) {//{{{
|
||||
console.log("point");
|
||||
console.log(event);
|
||||
show_debug(event.type)
|
||||
show_debug(event.clientX)
|
||||
show_debug(event.clientY)
|
||||
show_debug(JSON.stringify(event.touches[0]))
|
||||
show_debug(JSON.stringify(event))
|
||||
|
||||
|
||||
var point = trans({x:event.offsetX||event.clientX, y:event.offsetY||event.clientY});
|
||||
var point = trans({x:event.offsetX, y:event.offsetY});
|
||||
if (event.type == "touchstart") {
|
||||
var point = trans({x:event.touches[0].clientX, y:event.touches[0].clientY});
|
||||
}
|
||||
|
||||
if (current_ctx.index_point) {
|
||||
draw.beginPath();
|
||||
@ -477,22 +473,12 @@ function draw_point(event) {//{{{
|
||||
//}}}
|
||||
function draw_move(event) {//{{{
|
||||
var point = trans({x:event.offsetX, y:event.offsetY});
|
||||
show_debug("", true);
|
||||
conf("config", "point", parseInt(point.x)+","+parseInt(point.y));
|
||||
|
||||
if (conf("config", "shape") == "move") {
|
||||
if (current_ctx.index_point) {
|
||||
draw.beginPath();
|
||||
draw.arc(point.x, point.y, 5, 0, 2*Math.PI);
|
||||
draw.fill();
|
||||
}
|
||||
}
|
||||
|
||||
if (current_ctx.begin_point) {
|
||||
refresh();
|
||||
draws(draw, conf("config", "color"), conf("config", "stroke"), conf("config", "shape"), current_ctx.begin_point, point, "");
|
||||
}
|
||||
return false
|
||||
}
|
||||
//}}}
|
||||
|
||||
|
@ -26,9 +26,6 @@
|
||||
<canvas id="draw" width="400" height="400"
|
||||
onmousemove="draw_move(event)"
|
||||
onmouseup="draw_point(event)"
|
||||
onclick="draw_point(event)"
|
||||
ontouchstart="draw_point(event)"
|
||||
ontouchend="draw_point(event)"
|
||||
></canvas>
|
||||
<br/>
|
||||
<select class="config shape"></select>
|
||||
|
Loading…
x
Reference in New Issue
Block a user