[OpenLayers-Commits] r11821 - in sandbox/cmoullet/openlayers: .
examples lib/OpenLayers/Geometry lib/OpenLayers/Handler
lib/OpenLayers/Strategy tests/Geometry tests/Handler tests/Strategy
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Mar 31 02:55:07 EDT 2011
Author: cmoullet
Date: 2011-03-30 23:55:06 -0700 (Wed, 30 Mar 2011)
New Revision: 11821
Modified:
sandbox/cmoullet/openlayers/
sandbox/cmoullet/openlayers/examples/mobile-drawing.html
sandbox/cmoullet/openlayers/lib/OpenLayers/Geometry/LinearRing.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Feature.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/RegularPolygon.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Filter.js
sandbox/cmoullet/openlayers/tests/Geometry/LinearRing.html
sandbox/cmoullet/openlayers/tests/Handler/Click.html
sandbox/cmoullet/openlayers/tests/Handler/Drag.html
sandbox/cmoullet/openlayers/tests/Strategy/Filter.html
Log:
Merge with trunk
Property changes on: sandbox/cmoullet/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11775,11777-11798
+ /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11775,11777-11820
Modified: sandbox/cmoullet/openlayers/examples/mobile-drawing.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-drawing.html 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/examples/mobile-drawing.html 2011-03-31 06:55:06 UTC (rev 11821)
@@ -2,6 +2,7 @@
<html>
<head>
<title>OpenLayers Mobile Drawing</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0;">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="style.mobile.css" type="text/css">
@@ -24,6 +25,36 @@
bottom: 5px;
right: 5px;
}
+ div.olControlZoomPanel .olControlZoomInItemInactive,
+ div.olControlZoomPanel .olControlZoomOutItemInactive {
+ background: rgba(0,0,0,0.2);
+ position: absolute;
+ }
+ div.olControlZoomPanel .olControlZoomInItemInactive {
+ border-radius: 5px 5px 0 0;
+ }
+ div.olControlZoomPanel .olControlZoomOutItemInactive {
+ border-radius: 0 0 5px 5px ;
+ top: 37px;
+ }
+ div.olControlZoomPanel .olControlZoomOutItemInactive:after,
+ div.olControlZoomPanel .olControlZoomInItemInactive:after {
+ font-weight: bold;
+ content: '+';
+ font-size: 36px;
+ padding: 7px;
+ z-index: 2000;
+ color: #fff;
+ line-height: 1em;
+ }
+ div.olControlZoomPanel .olControlZoomOutItemInactive:after {
+ content: '–';
+ line-height: 0.9em;
+ padding: 0 8px;
+ }
+ div.olControlZoomPanel .olControlZoomToMaxExtentItemInactive {
+ display: none;
+ }
#title, #tags, #shortdesc {
display: none;
}
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Geometry/LinearRing.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Geometry/LinearRing.js 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Geometry/LinearRing.js 2011-03-31 06:55:06 UTC (rev 11821)
@@ -93,7 +93,7 @@
* point - {<OpenLayers.Geometry.Point>}
*/
removeComponent: function(point) {
- if (this.components.length > 4) {
+ if (this.components.length > 3) {
//remove last point
this.components.pop();
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js 2011-03-31 06:55:06 UTC (rev 11821)
@@ -515,6 +515,8 @@
this.clearTimer();
this.down = null;
this.first = null;
+ this.last = null;
+ this.touch = false;
deactivated = true;
}
return deactivated;
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js 2011-03-31 06:55:06 UTC (rev 11821)
@@ -145,6 +145,7 @@
};
}
},
+
/**
* Method: dragstart
@@ -507,6 +508,7 @@
deactivate: function() {
var deactivated = false;
if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+ this.touch = false;
this.started = false;
this.dragging = false;
this.start = null;
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Feature.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Feature.js 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Feature.js 2011-03-31 06:55:06 UTC (rev 11821)
@@ -120,7 +120,7 @@
/**
* Method: touchstart
- * Handle touchmove events
+ * Handle touchstart events
*
* Parameters:
* evt - {Event}
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/RegularPolygon.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/RegularPolygon.js 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/RegularPolygon.js 2011-03-31 06:55:06 UTC (rev 11821)
@@ -303,7 +303,7 @@
* evt - {Event} The mouse out event
*/
out: function(evt) {
- this.cancel();
+ this.finalize();
},
/**
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Filter.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Filter.js 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Filter.js 2011-03-31 06:55:06 UTC (rev 11821)
@@ -138,17 +138,19 @@
// cache now contains features to remove from layer
if (this.cache.length > 0) {
this.caching = true;
- this.layer.removeFeatures(this.cache.slice(), {silent: true});
+ this.layer.removeFeatures(this.cache.slice());
this.caching = false;
}
// now look through previous cache for features to add to layer
if (previousCache.length > 0) {
var event = {features: previousCache};
this.handleAdd(event);
- // event has features to add to layer
- this.caching = true;
- this.layer.addFeatures(event.features, {silent: true});
- this.caching = false;
+ if (event.features.length > 0) {
+ // event has features to add to layer
+ this.caching = true;
+ this.layer.addFeatures(event.features);
+ this.caching = false;
+ }
}
},
Modified: sandbox/cmoullet/openlayers/tests/Geometry/LinearRing.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Geometry/LinearRing.html 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/tests/Geometry/LinearRing.html 2011-03-31 06:55:06 UTC (rev 11821)
@@ -58,7 +58,7 @@
}
function test_LinearRing_removeComponent(t) {
- t.plan(11);
+ t.plan(10);
var components = [new OpenLayers.Geometry.Point(0,0),
new OpenLayers.Geometry.Point(0,10),
@@ -71,7 +71,7 @@
t.eq(ring.components.length, 4, "removing from linear ring with 5 points: length ok");
t.ok(ring.components[0].equals(components[0]), "point one correct");
t.ok(ring.components[1].equals(components[1]), "point two correct");
- t.ok(ring.components[2].equals(components[3]), "point one correct");
+ t.ok(ring.components[2].equals(components[3]), "point three correct");
t.ok(ring.components[0] === ring.components[ring.components.length - 1],
"first and last point are the same");
@@ -80,10 +80,10 @@
t.ok(ringBounds.equals(testBounds), "bounds correctly recalculated");
ring.removeComponent( ring.components[2] );
- t.eq(ring.components.length, 4, "cant remove from linear ring with only 4 points. new length ok (unchanged)");
+ ring.removeComponent( ring.components[1] );
+ t.eq(ring.components.length, 3, "cant remove from linear ring with only 3 points. new length ok");
t.ok(ring.components[0].equals(components[0]), "point one correct");
t.ok(ring.components[1].equals(components[1]), "point two correct");
- t.ok(ring.components[2].equals(components[3]), "point one correct");
t.ok(ring.components[0] === ring.components[ring.components.length - 1],
"first and last point are the same");
Modified: sandbox/cmoullet/openlayers/tests/Handler/Click.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Click.html 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/tests/Handler/Click.html 2011-03-31 06:55:06 UTC (rev 11821)
@@ -410,7 +410,7 @@
}
function test_Handler_Click_deactivate(t) {
- t.plan(4);
+ t.plan(6);
var control = {
map: new OpenLayers.Map('map')
};
@@ -422,6 +422,8 @@
handler.active = true;
handler.down = true;
handler.timerId = true;
+ handler.touch = true;
+ handler.last = true;
deactivated = handler.deactivate();
t.ok(deactivated,
"deactivate returns true if the handler was active already");
@@ -429,6 +431,11 @@
"deactivate sets down to null");
t.eq(handler.timerId, null,
"deactivate sets timerId to null");
+ t.eq(handler.touch, false,
+ "deactivate sets touch to false");
+ t.eq(handler.last, null,
+ "deactivate sets last to null");
+
}
function test_Handler_Click_mouseup(t) {
Modified: sandbox/cmoullet/openlayers/tests/Handler/Drag.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Drag.html 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/tests/Handler/Drag.html 2011-03-31 06:55:06 UTC (rev 11821)
@@ -416,7 +416,7 @@
}
function test_Handler_Drag_deactivate(t) {
- t.plan(6);
+ t.plan(7);
var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control();
map.addControl(control);
@@ -427,6 +427,7 @@
"deactivate returns false if the handler was not already active");
handler.active = true;
handler.dragging = true;
+ handler.touch = true;
deactivated = handler.deactivate();
t.ok(deactivated,
"deactivate returns true if the handler was active already");
@@ -437,7 +438,9 @@
t.ok(handler.start == null,
"deactivate sets start to null");
t.ok(handler.last == null,
- "deactivate sets start to null");
+ "deactivate sets last to null");
+ t.ok(!handler.touch,
+ "deactivate sets touch to false");
}
function test_interval_timer_after_mouseup(t) {
Modified: sandbox/cmoullet/openlayers/tests/Strategy/Filter.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Strategy/Filter.html 2011-03-30 23:59:51 UTC (rev 11820)
+++ sandbox/cmoullet/openlayers/tests/Strategy/Filter.html 2011-03-31 06:55:06 UTC (rev 11821)
@@ -70,7 +70,7 @@
function test_setFilter(t) {
- t.plan(7);
+ t.plan(13);
var strategy = new OpenLayers.Strategy.Filter({filter: filter});
var layer = new OpenLayers.Layer.Vector(null, {
@@ -84,24 +84,43 @@
center: new OpenLayers.LonLat(0, 0),
zoom: 1
});
+
+ var log = [];
+ layer.events.on({
+ beforefeaturesadded: function(event) {
+ log.push(event.type);
+ },
+ beforefeaturesremoved: function(event) {
+ log.push(event.type);
+ }
+ })
- // add all features
+ // a) add all features
+ log = [];
layer.addFeatures(features);
- t.eq(features.length, 20, "collection of 20 features")
- t.eq(layer.features.length, 10, "layer got 10 with filter 'index < 10'");
- t.eq(strategy.cache.length, 10, "strategy cached 10 with filter 'index < 10'");
+ t.eq(features.length, 20, "a) collection of 20 features")
+ t.eq(layer.features.length, 10, "a) layer got 10 with filter 'index < 10'");
+ t.eq(strategy.cache.length, 10, "a) strategy cached 10 with filter 'index < 10'");
+ t.eq(log.length, 1, "a) one event logged");
+ t.eq(log[0], "beforefeaturesadded", "a) beforefeaturesadded fired");
- // update filter
+ // b) update filter
+ log = [];
filter.value = 5;
strategy.setFilter(filter);
- t.eq(layer.features.length, 5, "layer got 5 with filter 'index < 5'");
- t.eq(strategy.cache.length, 15, "strategy cached 15 with filter 'index < 5'");
+ t.eq(layer.features.length, 5, "b) layer got 5 with filter 'index < 5'");
+ t.eq(strategy.cache.length, 15, "b) strategy cached 15 with filter 'index < 5'");
+ t.eq(log.length, 1, "b) one event logged");
+ t.eq(log[0], "beforefeaturesremoved", "b) beforefeaturesremoved fired");
- // update filter
+ // c) update filter
+ log = [];
filter.value = 15;
strategy.setFilter(filter);
- t.eq(layer.features.length, 15, "layer got 15 with filter 'index < 15'");
- t.eq(strategy.cache.length, 5, "strategy cached 5 with filter 'index < 15'");
+ t.eq(layer.features.length, 15, "c) layer got 15 with filter 'index < 15'");
+ t.eq(strategy.cache.length, 5, "c) strategy cached 5 with filter 'index < 15'");
+ t.eq(log.length, 1, "c) one event logged");
+ t.eq(log[0], "beforefeaturesadded", "c) beforefeaturesadded fired");
map.destroy();
More information about the Commits
mailing list