I'm trying to change to opacity of a mapLabel, but turns out there is no opacity attribute in the reference: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/maplabel/docs/reference.html
Asked
Active
Viewed 588 times
1
-
Are you answering your own question? In that case, you should post your answer as an answer, not part of the question. Also, you might want to have a look at [code formatting help](http://stackoverflow.com/editing-help#link-code). – svick Jun 10 '13 at 16:18
-
it gave me an error, "Users with less than 10 reputation can't answer their own question for 8 hours after asking. You can answer in 7 hours. Until then please use comments, or edit your question instead". Will try fixing the code format – Thompson Sanjoto Jun 10 '13 at 16:27
1 Answers
1
Solution: in maplabel.js add:
function MapLabel(opt_options)
{
...
this.set('opacity',1);
...
}
and add another:
<MapLabel.prototype.changed = function(prop)
{
switch (prop) {
...
case 'opacity':
return this.drawCanvas_();
...
}
}
and 1 more:
MapLabel.prototype.drawCanvas_ = function()
{
...
ctx.fillStyle = this.get('fontColor');
ctx.globalAlpha = this.get('opacity');
ctx.font = this.get('fontSize') + 'px ' + this.get('fontFamily');
...
}
this won't solve if you want to search strokeOpacity though...
Oh, and I'm sorry if I didn't do an actual question or anything correctly, first time submitting in stackoverflow to post a solution.

Community
- 1
- 1

Thompson Sanjoto
- 21
- 1
- 4