From 78c0521e742caaa79ff489b1588881e765b6414c Mon Sep 17 00:00:00 2001 From: shaoying Date: Sat, 1 Sep 2018 01:20:04 +0800 Subject: [PATCH] mac add touch --- src/contexts/web/web.go | 7 ++++--- usr/wiki/html5.js | 22 ++++------------------ usr/wiki/html5.md | 3 --- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/contexts/web/web.go b/src/contexts/web/web.go index d7da92ad..2d5494e8 100644 --- a/src/contexts/web/web.go +++ b/src/contexts/web/web.go @@ -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) diff --git a/usr/wiki/html5.js b/usr/wiki/html5.js index 57706088..041d1344 100644 --- a/usr/wiki/html5.js +++ b/usr/wiki/html5.js @@ -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 } //}}} diff --git a/usr/wiki/html5.md b/usr/wiki/html5.md index 5e38b526..0ec44bb2 100644 --- a/usr/wiki/html5.md +++ b/usr/wiki/html5.md @@ -26,9 +26,6 @@