1
0
Fork 0
forked from 0x2620/oxjs

more docs

This commit is contained in:
j 2011-05-16 12:49:48 +02:00
commit cc75e25415
42 changed files with 664 additions and 93 deletions

View file

@ -1,4 +1,16 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapRectangle <f> MapRectangle Object
() -> <f> MapRectangle Object
(options) -> <f> MapRectangle Object
(options, self) -> <f> MapRectangle Object
options <o> Options object
map <o|null> map
place <o|null> place
self <o> shared private variable
@*/
Ox.MapRectangle = function(options, self) {
var options = Ox.extend({
@ -11,10 +23,16 @@ Ox.MapRectangle = function(options, self) {
that[key] = val;
});
/*@
rectangle <f> google.maps.Rectangle
@*/
that.rectangle = new google.maps.Rectangle({
clickable: true,
bounds: that.place.bounds,
});
/*@
markers <a> array of markers
@*/
that.markers = Ox.map(that.place.points, function(point, position) {
return new Ox.MapRectangleMarker({
map: that.map,
@ -48,12 +66,18 @@ Ox.MapRectangle = function(options, self) {
})
}
/*@
add <f> add
@*/
that.add = function() {
that.rectangle.setMap(that.map.map);
google.maps.event.addListener(that.rectangle, 'click', click);
return that;
};
/*@
deselect <f> deselect
@*/
that.deselect = function() {
setOptions();
Ox.print('MARKERS', that.markers)
@ -62,12 +86,18 @@ Ox.MapRectangle = function(options, self) {
});
};
/*@
remove <f> remove
@*/
that.remove = function() {
that.rectangle.setMap(null);
google.maps.event.clearListeners(that.rectangle);
return that
}
/*@
select <f> select
@*/
that.select = function() {
setOptions();
Ox.forEach(that.markers, function(marker) {
@ -75,6 +105,9 @@ Ox.MapRectangle = function(options, self) {
});
};
/*@
update <f> udpate
@*/
that.update = function() {
that.rectangle.setOptions({
bounds: that.place.bounds