Skip to content

Commit dc17182

Browse files
committed
Merge branch 'master' of git://github.com/openlayers/openlayers
2 parents c086656 + cae4df3 commit dc17182

File tree

9 files changed

+936
-414
lines changed

9 files changed

+936
-414
lines changed

examples/mobile-drawing.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ function init() {
55
styleMap: new OpenLayers.StyleMap({
66
temporary: OpenLayers.Util.applyDefaults({
77
pointRadius: 16
8-
}, OpenLayers.Feature.Vector.style.temporary)
8+
}, OpenLayers.Feature.Vector.style.temporary),
9+
'default': OpenLayers.Util.applyDefaults({
10+
pointRadius: 16,
11+
strokeWidth: 3,
12+
}, OpenLayers.Feature.Vector.style['default']),
13+
select: OpenLayers.Util.applyDefaults({
14+
pointRadius: 16,
15+
strokeWidth: 3
16+
}, OpenLayers.Feature.Vector.style.select)
917
})
1018
});
1119

lib/OpenLayers/BaseTypes/Bounds.js

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -355,39 +355,59 @@ OpenLayers.Bounds = OpenLayers.Class({
355355
* object.
356356
*/
357357
extend:function(object) {
358-
var bounds = null;
359358
if (object) {
360-
// clear cached center location
361359
switch(object.CLASS_NAME) {
362-
case "OpenLayers.LonLat":
363-
bounds = new OpenLayers.Bounds(object.lon, object.lat,
364-
object.lon, object.lat);
360+
case "OpenLayers.LonLat":
361+
this.extendXY(object.lon, object.lat);
365362
break;
366363
case "OpenLayers.Geometry.Point":
367-
bounds = new OpenLayers.Bounds(object.x, object.y,
368-
object.x, object.y);
364+
this.extendXY(object.x, object.y);
369365
break;
370-
371-
case "OpenLayers.Bounds":
372-
bounds = object;
366+
367+
case "OpenLayers.Bounds":
368+
// clear cached center location
369+
this.centerLonLat = null;
370+
371+
if ( (this.left == null) || (object.left < this.left)) {
372+
this.left = object.left;
373+
}
374+
if ( (this.bottom == null) || (object.bottom < this.bottom) ) {
375+
this.bottom = object.bottom;
376+
}
377+
if ( (this.right == null) || (object.right > this.right) ) {
378+
this.right = object.right;
379+
}
380+
if ( (this.top == null) || (object.top > this.top) ) {
381+
this.top = object.top;
382+
}
373383
break;
374384
}
375-
376-
if (bounds) {
377-
this.centerLonLat = null;
378-
if ( (this.left == null) || (bounds.left < this.left)) {
379-
this.left = bounds.left;
380-
}
381-
if ( (this.bottom == null) || (bounds.bottom < this.bottom) ) {
382-
this.bottom = bounds.bottom;
383-
}
384-
if ( (this.right == null) || (bounds.right > this.right) ) {
385-
this.right = bounds.right;
386-
}
387-
if ( (this.top == null) || (bounds.top > this.top) ) {
388-
this.top = bounds.top;
389-
}
390-
}
385+
}
386+
},
387+
388+
/**
389+
* APIMethod: extendXY
390+
* Extend the bounds to include the XY coordinate specified.
391+
*
392+
* Parameters:
393+
* x - {number} The X part of the the coordinate.
394+
* y - {number} The Y part of the the coordinate.
395+
*/
396+
extendXY:function(x, y) {
397+
// clear cached center location
398+
this.centerLonLat = null;
399+
400+
if ((this.left == null) || (x < this.left)) {
401+
this.left = x;
402+
}
403+
if ((this.bottom == null) || (y < this.bottom)) {
404+
this.bottom = y;
405+
}
406+
if ((this.right == null) || (x > this.right)) {
407+
this.right = x;
408+
}
409+
if ((this.top == null) || (y > this.top)) {
410+
this.top = y;
391411
}
392412
},
393413

0 commit comments

Comments
 (0)