File indexing completed on 2026-04-09 07:58:27
0001 GMaps.prototype.createControl = function(options) {
0002 var control = document.createElement('div');
0003
0004 control.style.cursor = 'pointer';
0005
0006 if (options.disableDefaultStyles !== true) {
0007 control.style.fontFamily = 'Roboto, Arial, sans-serif';
0008 control.style.fontSize = '11px';
0009 control.style.boxShadow = 'rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px';
0010 }
0011
0012 for (var option in options.style) {
0013 control.style[option] = options.style[option];
0014 }
0015
0016 if (options.id) {
0017 control.id = options.id;
0018 }
0019
0020 if (options.classes) {
0021 control.className = options.classes;
0022 }
0023
0024 if (options.content) {
0025 if (typeof options.content === 'string') {
0026 control.innerHTML = options.content;
0027 }
0028 else if (options.content instanceof HTMLElement) {
0029 control.appendChild(options.content);
0030 }
0031 }
0032
0033 if (options.position) {
0034 control.position = google.maps.ControlPosition[options.position.toUpperCase()];
0035 }
0036
0037 for (var ev in options.events) {
0038 (function(object, name) {
0039 google.maps.event.addDomListener(object, name, function(){
0040 options.events[name].apply(this, [this]);
0041 });
0042 })(control, ev);
0043 }
0044
0045 control.index = 1;
0046
0047 return control;
0048 };
0049
0050 GMaps.prototype.addControl = function(options) {
0051 var control = this.createControl(options);
0052
0053 this.controls.push(control);
0054 this.map.controls[control.position].push(control);
0055
0056 return control;
0057 };
0058
0059 GMaps.prototype.removeControl = function(control) {
0060 var position = null,
0061 i;
0062
0063 for (i = 0; i < this.controls.length; i++) {
0064 if (this.controls[i] == control) {
0065 position = this.controls[i].position;
0066 this.controls.splice(i, 1);
0067 }
0068 }
0069
0070 if (position) {
0071 for (i = 0; i < this.map.controls.length; i++) {
0072 var controlsForPosition = this.map.controls[control.position];
0073
0074 if (controlsForPosition.getAt(i) == control) {
0075 controlsForPosition.removeAt(i);
0076
0077 break;
0078 }
0079 }
0080 }
0081
0082 return control;
0083 };