Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Area specific highlight effect with alt image #90

Closed
aduke opened this issue Oct 11, 2012 · 7 comments
Closed

Area specific highlight effect with alt image #90

aduke opened this issue Oct 11, 2012 · 7 comments
Labels

Comments

@aduke
Copy link

aduke commented Oct 11, 2012

I am trying to build 1 map that has some areas that use an alt image as the highlight effect and other areas that use fill colors as the highlight effect. Is this possible?

Can I specify an alt image and then override the area highlight part for some areas so that it just uses fillColor?...

or only specify altImage for certain areas?

@jamietre
Copy link
Owner

Copy of my answer from feedback seciotn - Yes, you can. This example shows preconfiguring areas:

http://jsfiddle.net/jamietre/vc8zG/

This uses altImage "aliases" - the altImage option configures the images that will be preloaded, then in the "areas" option, you tell it to use one of them (referring to its alias that you created, in my example, either img4 or img5) for "render_select" or "render_highlight", or both. The example shows Texas with two different alternate images for select & highlight, and Washington with an altimage just for select. The rest of the areas are defaulting to fills.

You can also decide on the fly how to select an area using "set" e.g.

myImage.mapster('set',true,'WA', { altImage: 'img4' });

would select the area with key 'WA' and use the altimage alias img4 for the effects. You can pass any rendering options with "set" this way.

@aduke
Copy link
Author

aduke commented Oct 11, 2012

Thanks so much! I had to use the dev version of imagemapster.js. Any idea when the next production version drops?

@jamietre
Copy link
Owner

Wow, I honestly thought that feature was in 1.2.6! Sorry for not pointing that out. The code for 1.2.7 is done and pretty well tested - the only real holdup on release has been me having a couple hours to write up some release notes and maybe a few more unit tests for that altimage stuff. I've been slammed at work (and also pushing out a release on another project) so I'm not sure when that will actually happen. But it is unlikely anything will change from what's here, so you should feel pretty good about using the 1.2.7 beta.

@aduke
Copy link
Author

aduke commented Oct 11, 2012

Ok cool, beta it is! Sent some coffee money your way ;)

@jamietre
Copy link
Owner

Wow, thanks for the really generous contrib! I appreciate it!

@ApetweBc
Copy link

Guys using altImage produce. It seems the image is not loaded before initiates. How do I solve this?

to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)

@techfg
Copy link
Collaborator

techfg commented Jan 31, 2021

@ApetweBc - The issue you are encountering is likely the same as the one identified in #316. Please see details there and try using the latest version of IM where that issue was addressed. Also, for future reference, please open new tickets when reporting issues rather than commenting on closed tickets as we're unlikely to see anything added to closed issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants