我一直在试图调试,没有运气。当我看着堆栈,并且它触及了我设置的所有中断点(假设类型是多边形,并且我放了所有应该出现的中断)时,我有一个通过开关盒掉落的情况。我打了每一个,但它失败了。所以..这是第一个可以工作的人。通过开关盒跌倒使谷歌地图元素似乎失败
that works ..我得到谷歌地图元素出来就好。现在有了变化,当我再次调试我打了所有破发点_OP对象填充有它的属性填充...但没有...
function create_map_element(type,op,map){
var _op={};
defined(map) ?_op.map=map:null;
switch(type){
case "polygon": case "polyline" : case "rectangle" : case "circle" : case "marker" :
defined(op.clickable) ?_op.clickable=op.clickable:null;
defined(op.visible) ?_op.visible=op.visible:null;
defined(op.zIndex) ?_op.zIndex=op.zIndex:null;
case "polygon": case "polyline" : case "rectangle" : case "circle" :
defined(op.strokeColor) ?_op.strokeColor=op.strokeColor:null;
defined(op.strokeOpacity) ?_op.strokeOpacity=op.strokeOpacity:null;
defined(op.strokeWeight) ?_op.strokeWeight=op.strokeWeight:null;
case "polygon": case "rectangle" : case "circle" :
defined(op.fillOpacity) ?_op.fillOpacity=op.fillOpacity:null;
case "polygon": case "polyline" :
defined(op.geodesic) ?_op.geodesic=op.geodesic:null;
case "marker" :
defined(op.animation) ?_op.animation=op.animation:null;
case "polygon" :
return new google.maps.Polygon(_op);
break;
case "rectangle" :
return new google.maps.Rectangle(_op);
break;
case "circle" :
return new google.maps.Circle(_op);
break;
case "polyline" :
return new google.maps.Polyline(_op);
break;
case "marker" :
return new google.maps.Marker(_op);
break;
};
}
但是,当我设置的retrun线的破发点,它击中它,并且所有看起来正确..但是..没什么。任何人有一个想法?谢谢 - 杰里米
[编辑] 基础上,嗯,我不知道是谁删除了他们的anwser但当时的情况SWTICH失败的原因在正确的轨道上......这里是我的选择正试图用与上述相同的想法来做。
function create_map_element(type,op,map){
var _op={};
defined(map)?_op.map=map:null;
defined(op.clickable) ?_op.clickable=op.clickable:null;
defined(op.visible) ?_op.visible=op.visible:null;
defined(op.zIndex) ?_op.zIndex=op.zIndex:null;
if(["polygon","polyline","rectangle","circle"].indexOf(type)!== -1 ){
defined(op.strokeColor) ?_op.strokeColor=op.strokeColor:null;
defined(op.strokeOpacity) ?_op.strokeOpacity=op.strokeOpacity:null;
defined(op.strokeWeight) ?_op.strokeWeight=op.strokeWeight:null;
}
if(["polygon","rectangle","circle"].indexOf(type)!== -1 ){
defined(op.fillColor) ?_op.fillColor=op.fillColor:null;
defined(op.fillOpacity) ?_op.fillOpacity=op.fillOpacity:null;
}
if(["polygon","polyline"].indexOf(type)!== -1 ){
defined(op.geodesic) ?_op.geodesic=op.geodesic:null;
}
if(type == "marker"){
defined(op.animation) ?_op.animation=op.animation:null;
defined(op.cursor) ?_op.cursor=op.cursor:null;
defined(op.draggable) ?_op.draggable=op.draggable:null;
defined(op.flat) ?_op.flat=op.flat:null;
defined(op.icon) ?_op.icon=op.icon:null;
defined(op.optimized) ?_op.optimized=op.optimized:null;
defined(op.position) ?_op.position=op.position:null;
defined(op.raiseOnDrag) ?_op.raiseOnDrag=op.raiseOnDrag:null;
defined(op.shadow) ?_op.shadow=op.shadow:null;
defined(op.shape) ?_op.shape=op.shape:null;
defined(op.title) ?_op.title=op.title:null;
}
switch(type){
case "polygon" :
return new google.maps.Polygon(_op);
break;
case "rectangle" :
return new google.maps.Rectangle(_op);
break;
case "circle" :
return new google.maps.Circle(_op);
break;
case "polyline" :
return new google.maps.Polyline(_op);
break;
case "marker" :
return new google.maps.Marker(_op);
break;
};
}
现在很奇怪,这不起作用,但它正确地击中所有断点,当我检查它时,它似乎很好。它只是不返回谷歌地图元素..再次顶端代码块(功能create_map_element3)确实工作..
好吧,在堆栈中说,但没有任何反应,似乎没有谷歌得到它。就像它之间有一些以太之类的东西就会迷路了。我检查返回的中断点,并按预期填充_op,看起来好像新的google.maps.Polygon(_op);火灾的权利...不是100%在这个atm – 2012-03-02 21:59:43
那么,这是真的比我最近的建议^^ – 2012-03-05 22:46:26
两个反对呢? @Dr。 Molle,你在开玩笑吗?对不起,我不这么认为。我会这样认为,因为你之前基于orginals开发过,编辑没有太大差别,这次我粘贴了这个东西。 – 2012-03-06 01:04:22