2012-06-20 09:38:32 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Leaflet debug page</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
|
|
|
|
2017-02-04 23:17:51 +08:00
|
|
|
<script src="../../build/deps.js"></script>
|
2012-06-20 09:38:32 +08:00
|
|
|
<script src="../leaflet-include.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="map" style="width: 800px; height: 600px; border: 1px solid #ccc"></div>
|
2012-06-20 09:48:57 +08:00
|
|
|
<div style="background-color:chartreuse; width: 100px; height:100px; position: absolute; left: 850px; top: 10px" onclick="Hack1()">Hack1Touch</div>
|
|
|
|
<div style="background-color:coral; width: 100px; height:100px; position: absolute; left: 850px; top: 120px" onclick="Hack2()">Hack2Touch</div>
|
2013-04-15 07:54:43 +08:00
|
|
|
<div style="background-color:lightblue; width: 100px; height:100px; position: absolute; left: 850px; top: 230px" onclick="Hack3()">Hack3Touch</div>
|
|
|
|
<div style="background-color:lightpink; width: 100px; height:100px; position: absolute; left: 850px; top: 340px" onclick="Hack4()">Hack4Touch</div>
|
|
|
|
<div style="background-color:yellow; width: 100px; height:100px; position: absolute; left: 850px; top: 450px" onclick="alert(buffer)">Print Buffer</div>
|
2012-06-20 09:38:32 +08:00
|
|
|
<script src="route.js"></script>
|
|
|
|
<script>
|
2013-04-15 07:54:43 +08:00
|
|
|
//var buffer = "";
|
|
|
|
//console.log = function (text) {
|
|
|
|
// buffer += text + "\r\n";
|
|
|
|
//}
|
2013-11-08 22:43:14 +08:00
|
|
|
|
2014-03-04 23:54:41 +08:00
|
|
|
var osmUrl = 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
|
|
|
|
osm = new L.TileLayer(osmUrl, {maxZoom: 18}),
|
|
|
|
map = new L.Map('map', {layers: [osm], center: new L.LatLng(51.505, -0.04), zoom: 13});
|
2012-06-20 09:38:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
var polygon = new L.Polygon([
|
|
|
|
new L.LatLng(51.51, -0.1),
|
|
|
|
new L.LatLng(51.5, -0.06),
|
|
|
|
new L.LatLng(51.52, -0.03)
|
|
|
|
]);
|
|
|
|
|
|
|
|
map.addLayer(polygon);
|
|
|
|
|
|
|
|
var polyline = new L.Polyline([
|
|
|
|
new L.LatLng(51.49, -0.02),
|
|
|
|
new L.LatLng(51.51, 0),
|
|
|
|
new L.LatLng(51.52, -0.02)
|
|
|
|
]);
|
|
|
|
|
|
|
|
map.addLayer(polyline);
|
|
|
|
|
|
|
|
polygon.on('edit', function() {
|
|
|
|
console.log('Polygon was edited!');
|
|
|
|
});
|
|
|
|
polyline.on('edit', function() {
|
|
|
|
console.log('Polyline was edited!');
|
|
|
|
});
|
|
|
|
|
2012-06-20 09:48:57 +08:00
|
|
|
var _timerAt, _timer;
|
2012-06-20 09:38:32 +08:00
|
|
|
function Hack1() {
|
|
|
|
_timerAt = 0;
|
2012-06-20 09:48:57 +08:00
|
|
|
clearInterval(_timer);
|
2013-04-15 07:54:43 +08:00
|
|
|
_timer = setInterval(Hack1Timer, 200);
|
2012-06-20 09:38:32 +08:00
|
|
|
}
|
|
|
|
function Hack1Timer() {
|
2013-04-15 07:54:43 +08:00
|
|
|
console.log(_timerAt);
|
2012-06-20 09:38:32 +08:00
|
|
|
switch (_timerAt) {
|
|
|
|
case 0:
|
|
|
|
map.touchZoom._onTouchStart({ touches: [{ pageX: 405, pageY: 312 }, { pageX: 233, pageY: 321 }] });
|
|
|
|
break;
|
|
|
|
case 1:
|
2013-04-15 07:54:43 +08:00
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 452, pageY: 312 }, { pageX: 236, pageY: 322 }] });
|
2012-06-20 09:38:32 +08:00
|
|
|
break;
|
|
|
|
case 2:
|
2013-04-15 07:54:43 +08:00
|
|
|
map.touchZoom._onTouchEnd();
|
2012-06-20 09:38:32 +08:00
|
|
|
break;
|
2012-06-20 12:24:43 +08:00
|
|
|
case 3:
|
2013-04-15 07:54:43 +08:00
|
|
|
map.touchZoom._onTouchStart({ touches: [{ pageX: 423, pageY: 313 }, { pageX: 243, pageY: 321 }] });
|
2012-06-20 09:38:32 +08:00
|
|
|
break;
|
2012-06-20 12:24:43 +08:00
|
|
|
case 4:
|
2013-04-15 07:54:43 +08:00
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 423, pageY: 313 }, { pageX: 243, pageY: 321 }] });
|
|
|
|
//map.touchZoom._onTouchMove({ touches: [{ pageX: 476, pageY: 326 }, { pageX: 299, pageY: 321 }] });
|
2012-06-20 09:38:32 +08:00
|
|
|
break;
|
2012-06-20 12:24:43 +08:00
|
|
|
case 5:
|
2013-04-15 07:54:43 +08:00
|
|
|
map.touchZoom._onTouchEnd();
|
|
|
|
break;
|
|
|
|
case 6:
|
2012-06-20 09:48:57 +08:00
|
|
|
clearInterval(_timer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
_timerAt++;
|
|
|
|
}
|
|
|
|
function Hack2() {
|
2013-04-15 07:54:43 +08:00
|
|
|
_timerAt = 0;
|
|
|
|
clearInterval(_timer);
|
|
|
|
_timer = setInterval(Hack2Timer, 100);
|
2012-06-20 09:48:57 +08:00
|
|
|
}
|
|
|
|
function Hack2Timer() {
|
2013-04-15 07:54:43 +08:00
|
|
|
console.log(_timerAt);
|
2012-06-20 09:48:57 +08:00
|
|
|
switch (_timerAt) {
|
|
|
|
case 0:
|
|
|
|
map.touchZoom._onTouchStart({ touches: [{ pageX: 100, pageY: 100 }, { pageX: 50, pageY: 100}] });
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 100, pageY: 100 }, { pageX: 50, pageY: 100 }] });
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 110, pageY: 100 }, { pageX: 50, pageY: 100 }] });
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 120, pageY: 100 }, { pageX: 50, pageY: 100 }] });
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 130, pageY: 100 }, { pageX: 50, pageY: 100 }] });
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 140, pageY: 100 }, { pageX: 50, pageY: 100 }] });
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 150, pageY: 100 }, { pageX: 50, pageY: 100 }] });
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
map.touchZoom._onTouchEnd();
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
clearInterval(_timer);
|
|
|
|
break;
|
2012-06-20 09:38:32 +08:00
|
|
|
}
|
|
|
|
_timerAt++;
|
|
|
|
}
|
2013-04-15 07:54:43 +08:00
|
|
|
function Hack3() {
|
|
|
|
_timerAt = 0;
|
|
|
|
clearInterval(_timer);
|
|
|
|
_timer = setInterval(Hack3Timer, 100);
|
|
|
|
}
|
|
|
|
function Hack3Timer() {
|
|
|
|
console.log(_timerAt);
|
|
|
|
switch (_timerAt) {
|
|
|
|
case 0:
|
|
|
|
map.touchZoom._onTouchStart({ touches: [{ pageX: 405, pageY: 312 }, { pageX: 233, pageY: 321 }] });
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 412, pageY: 312 }, { pageX: 236, pageY: 322 }] });
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
map.touchZoom._onTouchEnd();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
map.touchZoom._onTouchStart({ touches: [{ pageX: 423, pageY: 313 }, { pageX: 243, pageY: 321 }] });
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 476, pageY: 326 }, { pageX: 299, pageY: 321 }] });
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
map.touchZoom._onTouchEnd();
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
clearInterval(_timer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
_timerAt++;
|
|
|
|
}
|
2013-11-08 22:43:14 +08:00
|
|
|
|
2013-04-15 07:54:43 +08:00
|
|
|
function Hack4() {
|
|
|
|
_timerAt = 0;
|
|
|
|
clearInterval(_timer);
|
|
|
|
_timer = setInterval(Hack4Timer, 40);
|
|
|
|
}
|
|
|
|
function Hack4Timer() {
|
|
|
|
console.log(_timerAt);
|
|
|
|
switch (_timerAt) {
|
|
|
|
case 0:
|
|
|
|
map.touchZoom._onTouchStart({ touches: [{ pageX: 405, pageY: 312 }, { pageX: 233, pageY: 321 }] });
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 405, pageY: 312 }, { pageX: 236, pageY: 322 }] });
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
map.touchZoom._onTouchEnd();
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
map.touchZoom._onTouchStart({ touches: [{ pageX: 405, pageY: 312 }, { pageX: 233, pageY: 321 }] });
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
map.touchZoom._onTouchMove({ touches: [{ pageX: 405, pageY: 312 }, { pageX: 233, pageY: 321 }] });
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
map.touchZoom._onTouchEnd();
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
clearInterval(_timer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
_timerAt++;
|
|
|
|
}
|
2012-06-20 09:38:32 +08:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|