0
我把示例代碼從這裏--->https://google-developers.appspot.com/maps/articles/mvcfun/step6調整大小圓(MVC對象)
,我已經爲了有一個最大和最小尺寸調整範圍增加了一些代碼.. 我成功使這兩個範圍的圈子停止,但調整大小標記不會停止,如圓...
我已經改變了唯一的事情就是從這個
RadiusWidget.prototype.setDistance = function() {
// As the sizer is being dragged, its position changes. Because the
// RadiusWidget's sizer_position is bound to the sizer's position, it will
// change as well.
var pos = this.get('sizer_position');
var center = this.get('center');
var distance = this.distanceBetweenPoints_(center, pos);
// Set the distance property for any objects that are bound to it
this.set('distance', distance);
};
這個
RadiusWidget.prototype.setDistance = function() {
// As the sizer is being dragged, its position changes. Because the
// RadiusWidget's sizer_position is bound to the sizer's position, it will
// change as well.
var min=0.5;
var max=15;
var pos = this.get('sizer_position');
var center = this.get('center');
var distance = this.distanceBetweenPoints_(center, pos);
if (distance < min){ distance = min;}
if (distance > max){distance = max;}
// Set the distance property for any objects that are bound to it
this.set('distance', distance);
};
ooh非常感謝你!這對我來說非常合適!保持良好的工作!再次感謝! –