//实现框选放大缩小功能
function DragZoomControl(opts_boxStyle, opts_other, opts_callbacks) {
this.globals = {
draggingOn: false,
cornerTopDiv: null,
cornerRightDiv: null,
cornerBottomDiv: null,
cornerLeftDiv: null,
mapPosition: null,
outlineDiv: null,
mapWidth: 0,
mapHeight: 0,
mapRatio: 0,
startX: 0,
startY: 0,
borderCorrection: 0
};
//设置边框的style
this.globals.style = {
opacity: .2,
fillColor: "#000",
border: "2px solid blue"
};
var style = this.globals.style;
for (var s in opts_boxStyle) {
style[s]=opts_boxStyle[s];
}
var borderStyleArray = style.border.split(' ');
style.outlineWidth = parseInt(borderStyleArray[0].replace(/\D/g,''));
style.outlineColor = borderStyleArray[2];
style.alphaIE = 'alpha(opacity=' + (style.opacity * 100) + ')';
this.globals.backStack=[];
------解决方案--------------------
ECMAScript 定义类或对象