1

我正在尝试更改为 mapLabel 的不透明度,但事实证明参考中没有不透明度属性:http: //google-maps-utility-library-v3.googlecode.com/svn/trunk/maplabel/docs/参考.html

4

1 回答 1

1

解决方案:在 maplabel.js 中添加:

function MapLabel(opt_options) 
{
    ...
    this.set('opacity',1);
    ...
}

并添加另一个:

<MapLabel.prototype.changed = function(prop)
{
    switch (prop) {
    ...     
    case 'opacity':
    return this.drawCanvas_();
    ...
    }
}

还有 1 个:

MapLabel.prototype.drawCanvas_ = function() 
{
    ...
    ctx.fillStyle = this.get('fontColor');
    ctx.globalAlpha = this.get('opacity');
    ctx.font = this.get('fontSize') + 'px ' + this.get('fontFamily');
    ...
}

如果您想搜索strokeOpacity,这将无法解决......

哦,如果我没有正确地做一个实际的问题或任何事情,我很抱歉,第一次在 stackoverflow 中提交以发布解决方案。

在 Google Maps V3 中将 MapLabel 放置在多边形顶部

绘制后如何更改画布元素中元素的不透明度(alpha,透明度)?

于 2013-06-11T03:16:41.437 回答