Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
blocks:app-note:interactivemap [2020-11-10 14:42] mattias [Interactive map] |
blocks:app-note:interactivemap [2023-08-01 21:07] (current) admin [Installation] |
||
---|---|---|---|
Line 13: | Line 13: | ||
We have prepared a PIXILAB-blocks-root folder containing everything you need to run the examples. | We have prepared a PIXILAB-blocks-root folder containing everything you need to run the examples. | ||
- | {{ : | + | {{ : |
- | If you don't know how to do this, read the instructions in the [[https:// | + | If you don't know how to do this, read the instructions in the [[blocks:app-note:start|general setup section]]. |
Line 50: | Line 50: | ||
=====How does this work?===== | =====How does this work?===== | ||
- | The interactive map itself is a custom web page that is stored under / | + | The interactive map itself is a custom web page that is stored under / |
+ | |||
+ | {{: | ||
+ | |||
+ | In blocks | ||
{{: | {{: | ||
In the URL setting of the web block there are two query-parameters. blocksVar will point to a blocks variable, svgFileName will set the filename of the svg file used for the project. | In the URL setting of the web block there are two query-parameters. blocksVar will point to a blocks variable, svgFileName will set the filename of the svg file used for the project. | ||
- | The map itself | + | The map image is a .svg file that is picked up by script.js and applied to the html document in runtime. |
- | Script.js uses the Blocks javascript bridge API called pub_sub_peer.js to set valuea | + | Script.js |
Line 64: | Line 68: | ||
In the SVG code the group with element ID " | In the SVG code the group with element ID " | ||
CountryA, CountryB and CountryC is the data that will be passed on as a string to the Blocks variable. | CountryA, CountryB and CountryC is the data that will be passed on as a string to the Blocks variable. | ||
- | This is also what returns from Blocks and used to find document elements that will get a class applied in order to style the element as currently selected. | + | This is also what returns from Blocks and used to find document elements that will get a class applied in order to highlight |
< | < | ||
Line 81: | Line 85: | ||
</ | </ | ||
</ | </ | ||
+ | |||