Quest 5.8 - Move Map to Right side?

Diablos97
07 Aug 2019, 13:22Just looking for how to move my auto-drawn (non-custom) map to the right side, instead of on top.
mrangel
07 Aug 2019, 19:19There was a thread a while ago working on moving the map and image panes to the sidebar. I think there's working code somewhere in that thread, which you can adapt to do what you want.

Dcoder
07 Aug 2019, 19:49Adding graphics in a specific location (GUI).....
http://textadventures.co.uk/forum/samples/topic/q5zedoe560au_ii73oamoq/adding-graphics-in-a-specific-location-gui-solved

Diablos97
12 Aug 2019, 02:06Okay, I found the code. I just need to know how to place it under the compass. Also, anyway to keep the zoom in/out ability for the player?
JS.eval ("$('<h3 id=\"mapLabel\" class=\"ui-accordion-header ui-helper-reset ui-state-active ui-corner-top\"><span class=\"ui-icon ui-icon-triangle-1-s\"></span><span class=\"accordion-header-text\">Map</span></h3><div id=\"mapAccordion\" class=\"ui-accordion-content-active ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom\"></div>').insertBefore(\"#inventoryLabel\");$('#gridPanel').hide();$('#gamePanelSpacer').height('0');var size = $(\"#mapAccordion\").innerWidth();$('#gridCanvas').width(size).height(size).appendTo($('#mapAccordion'));paper.view.viewSize.width = size;paper.view.viewSize.height = size;$(\"#gridPanel\").hide();$(\"#mapLabel\").bind(\"click\", $._data($(\"#inventoryLabel\")[0]).events['click'][0]['handler']);$(\"#mapLabel\").bind(\"mouseover\", $._data($(\"#inventoryLabel\")[0]).events['mouseover'][0]['handler']);$(\"#mapLabel\").bind(\"mouseout\", $._data($(\"#inventoryLabel\")[0]).events['mouseout'][0]['handler']);")
mrangel
12 Aug 2019, 14:58I just need to know how to place it under the compass.
Change .insertBefore(\"#inventoryLabel\")
to .insertAfter(\"#compassAccordion\")
, I think.
Also, anyway to keep the zoom in/out ability for the player?
I don't think this should affect the ability to zoom, but I've not tried it. Can you give a little more detail? Like what you try, what should happen, and what does happen?

Diablos97
12 Aug 2019, 17:03That moved it, now I have two Map labels somehow...? lol The 1st one populates as expected. 2nd is blank.
I don't think this should affect the ability to zoom, but I've not tried it. Can you give a little more detail? Like what you try, what should happen, and what does happen?
With the map in its default and unmodified location, you can zoom in or out with your mouse-wheel. With this script, you can't. I don't know if its not available with being moved, or unintentionally disabled.

Diablos97
13 Aug 2019, 23:29Any help on the double Map label? ^
mrangel
14 Aug 2019, 07:58I'm not sure how two labels would appear. Can you give a link to the game so I can take a look at it?

Diablos97
16 Aug 2019, 04:23This is a test buildout for the same game I'm working on, just locked to first room.
http://textadventures.co.uk/games/view/wuvt32g0j0kikjpjh7mgtq/test-build-for-map
mrangel
16 Aug 2019, 08:32Any help on the double Map label? ^
You have 2 objects, named Lucy1
and Lucy2
. Both of them have an initialisation screen which creates a pane in the right sidebar.
So when the game starts up, Lucy1 creates a map pane and moves the map there, and then Lucy2 creates a second pane above the first one and moves the map there, leaving an empty pane at the bottom.
This also means that the map will move back to its default position when loading a saved game. You really should put javascript like this in the UI Initialisation script, which is on the 'Advanced Scripts' tab of the game object (needs to be enabled in the 'Features' tab first).
Also, anyway to keep the zoom in/out ability for the player?
Try this:
JS.eval ("$('<h3 id=\"mapLabel\" class=\"ui-accordion-header ui-helper-reset ui-state-active ui-corner-top\"><span class=\"ui-icon ui-icon-triangle-1-s\"></span><span class=\"accordion-header-text\">Map</span></h3><div id=\"mapAccordion\" class=\"ui-accordion-content-active ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom\"></div>').bind('mousewheel',function (e,d) {gridApi.zoomIn(d);return false;}).insertBefore(\"#inventoryLabel\");$('#gridPanel').hide();$('#gamePanelSpacer').height('0');var size = $('#mapAccordion').innerWidth();$('#gridCanvas').width(size).height(size).appendTo($('#mapAccordion'));paper.view.viewSize.width = size;paper.view.viewSize.height = size;$('#gridPanel').hide();$('#mapLabel').bind('click', $._data($('#inventoryLabel')[0]).events['click'][0]['handler']);$('#mapLabel').bind('mouseover', $._data($('#inventoryLabel')[0]).events['mouseover'][0]['handler']);$('#mapLabel').bind('mouseout', $._data($('#inventoryLabel')[0]).events['mouseout'][0]['handler']);")

Diablos97
16 Aug 2019, 13:26Awesome, so the Advanced option for the game fixed the double label (thank you!). Used that script you gave, but no zooming ability, still.
ajalexxxxx
06 Sept 2019, 12:15Okay, thanks!
mrangel
06 Sept 2019, 15:12Used that script you gave, but no zooming ability, still.
I finally got around to actually testing it. Loaded the first game I found with a map (XanMag's easter game from last year), and pasted that code into it.
It works for me.
Do you get any error messages in the javascript console, or anything that might explain why it isn't behaving?

Diablos97
13 Sept 2019, 23:15Sorry for the radio silence. No errors that I can find. It just doesn't zoom with the mouse-wheel is the most I can see. This is the exact code I have, edited only for placement (insertAfter) as previously discussed:
JS.eval ("$('<h3 id=\"mapLabel\" class=\"ui-accordion-header ui-helper-reset ui-state-active ui-corner-top\"><span class=\"ui-icon ui-icon-triangle-1-s\"></span><span class=\"accordion-header-text\">Map</span></h3><div id=\"mapAccordion\" class=\"ui-accordion-content-active ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom\"></div>').bind('mousewheel',function (e,d) {gridApi.zoomIn(d);return false;}).insertAfter(\"#compassAccordion\");$('#gridPanel').hide();$('#gamePanelSpacer').height('0');var size = $('#mapAccordion').innerWidth();$('#gridCanvas').width(size).height(size).appendTo($('#mapAccordion'));paper.view.viewSize.width = size;paper.view.viewSize.height = size;$('#gridPanel').hide();$('#mapLabel').bind('click', $._data($('#inventoryLabel')[0]).events['click'][0]['handler']);$('#mapLabel').bind('mouseover', $._data($('#inventoryLabel')[0]).events['mouseover'][0]['handler']);$('#mapLabel').bind('mouseout', $._data($('#inventoryLabel')[0]).events['mouseout'][0]['handler']);")
mrangel
14 Sept 2019, 11:00Sorry, my screwup. The objectset returned by $("html")
has limitations depending on the version of jQuery. I didn't notice immediately because I try to avoid using that syntax.
Try this:
JS.eval ("$('<h3 id=\"mapLabel\" class=\"ui-accordion-header ui-helper-reset ui-state-active ui-corner-top\"><span class=\"ui-icon ui-icon-triangle-1-s\"></span><span class=\"accordion-header-text\">Map</span></h3><div id=\"mapAccordion\" class=\"ui-accordion-content-active ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom\"></div>').insertAfter(\"#compassAccordion\");$('#mapAccordion').bind('mousewheel',function (e,d) {gridApi.zoomIn(d);return false;});$('#gridPanel').hide();$('#gamePanelSpacer').height('0');var size = $('#mapAccordion').innerWidth();$('#gridCanvas').width(size).height(size).appendTo($('#mapAccordion'));paper.view.viewSize.width = size;paper.view.viewSize.height = size;$('#gridPanel').hide();$('#mapLabel').bind('click', $._data($('#inventoryLabel')[0]).events['click'][0]['handler']);$('#mapLabel').bind('mouseover', $._data($('#inventoryLabel')[0]).events['mouseover'][0]['handler']);$('#mapLabel').bind('mouseout', $._data($('#inventoryLabel')[0]).events['mouseout'][0]['handler']);")

Diablos97
15 Sept 2019, 05:42Nothing.
I playtest in the Quest program, and all I can get is the page to scroll, but the map does nothing. Maybe that's the limitation..?