FEATURE: setViewArea()
Moderators: dorpond, trevor, Azhrei
Forum rules
Posting now open to all registered forum users.
Posting now open to all registered forum users.
FEATURE: setViewArea()
Edit by moderator: topic split off in a seperate topic (http://forums.rptools.net/viewtopic.php?f=86&t=25958)
I've been thinking about the setZoom function and was wondering if it is what is really wanted?
Isn't what we actually want something more like setViewArea(x1, y1, x2, y2) ? Especially when you think about different players PCs etc. etc.
I've been thinking about the setZoom function and was wondering if it is what is really wanted?
Isn't what we actually want something more like setViewArea(x1, y1, x2, y2) ? Especially when you think about different players PCs etc. etc.
Re: FEATURE: updateView()
CorrectJagged wrote:I've been thinking about the setZoom function and was wondering if it is what is really wanted?
Isn't what we actually want something more like setViewArea(x1, y1, x2, y2) ? Especially when you think about different players PCs etc. etc.
Re: FEATURE: updateView()
but this sounds like a whole lot more work. E.g. what exactly do you do when it does not fit? e.g. (0,0,1,100) fairly certain no screen is that size, so then what?Craig wrote:CorrectJagged wrote:I've been thinking about the setZoom function and was wondering if it is what is really wanted?
Isn't what we actually want something more like setViewArea(x1, y1, x2, y2) ? Especially when you think about different players PCs etc. etc.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: FEATURE: updateView()
I was not thinking completely, I change my answer to still correct but...wolph42 wrote:but this sounds like a whole lot more work. E.g. what exactly do you do when it does not fit? e.g. (0,0,1,100) fairly certain no screen is that size, so then what?Craig wrote:CorrectJagged wrote:I've been thinking about the setZoom function and was wondering if it is what is really wanted?
Isn't what we actually want something more like setViewArea(x1, y1, x2, y2) ? Especially when you think about different players PCs etc. etc.
setViewArea() would take dimensions in world space and map them to the screen viewport. If we had independent x and y scaling then its easy. But since we don't there is a bit more thought involved.
So if you had setViewArea(0,0,100, 100) if you had independent x and y scaling and your map window was 640, by 400 the x scale factor would be 6.4 and y 4. Since we only have one scale factor (zoom level) then setViewArea would need to do something slightly different. I think the "most correct" answer would be to zoom to the level that guarantees that everything in the view area is displayed on the screen (even if that means a bit extra is displayed in one of the dimensions) so it would take the smallest scaling factor after working out y/x scaling factors and use that to calculate the zoom level. This means that people who have map windows 1920x1080 will see the same map as people with map windows 960x540 after setViewArea has run, just one will be more zoomed in than the other to achieve that effect.
Re: FEATURE: updateView()
A setViewArea would have an implied zoom. You would not have a separate scaling for x and y, but would calculate the scaling factor necessary to fit (in your example) 100 cells into your y dimension and set the screen accordingly. So given a 1000,800 screen size and a grid size of 50, 800/100/50 gives you your scaling factor (I think )wolph42 wrote: but this sounds like a whole lot more work. E.g. what exactly do you do when it does not fit? e.g. (0,0,1,100) fairly certain no screen is that size, so then what?
Happy to do some testing to see if this is possible.
Last edited by Jagged on Fri May 01, 2015 4:17 am, edited 1 time in total.
Re: FEATURE: updateView()
note that I edited my earlier post (quite a bit). Let me repost that part:
Also on the scripting side: the zoom/pan is a LOT less intuitive to to use for a pan and zoom and a lot more work to implement. Granted you have more control over what each client shows, but at the price of way to much hassle too set it up.
E.g. lets take a castle at which you want to 'zoom in' as animated effect. Its either;
or...
you tell me. (well I know what needs to be done, but it requires waay more thinking)
edit: note that I'm not against extra functionality and this function certainly has its merits I'm just discussing the 'is it what we really want' part.
Also on the scripting side: the zoom/pan is a LOT less intuitive to to use for a pan and zoom and a lot more work to implement. Granted you have more control over what each client shows, but at the price of way to much hassle too set it up.
E.g. lets take a castle at which you want to 'zoom in' as animated effect. Its either;
Code: Select all
goto(xCastle, yCastle)
setZoom(0.1)
loop(x=1 to 90): setZoom(getZoom()+x/100); updateView(); delay(10)
you tell me. (well I know what needs to be done, but it requires waay more thinking)
edit: note that I'm not against extra functionality and this function certainly has its merits I'm just discussing the 'is it what we really want' part.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: FEATURE: updateView()
It depends on what you are trying to achieve, If for example you wanted to shift the map to the above castle and display it large enough to take up most of the map you can do so with setViewArea() despite what the map windows dimensions are.wolph42 wrote:note that I edited my earlier post (quite a bit). Let me repost that part:
Also on the scripting side: the zoom/pan is a LOT less intuitive to to use for a pan and zoom and a lot more work to implement. Granted you have more control over what each client shows, but at the price of way to much hassle too set it up.
E.g. lets take a castle at which you want to 'zoom in' as animated effect. Its either;or...Code: Select all
goto(xCastle, yCastle) setZoom(0.1) loop(x=1 to 90): setZoom(getZoom()+x/100); updateView(); delay(10)
you tell me. (well I know what needs to be done, but it requires waay more thinking)
edit: note that I'm not against extra functionality and this function certainly has its merits I'm just discussing the 'is it what we really want' part.
Any animation would really have to be part of the setZoom()/setViewArea() etc, a delay(x) macro will be problematic because delaying macros for 10 seconds would require pausing most of maptool for 10 seconds (I think that also includes gui responding).
Re: FEATURE: updateView()
1. true. which only strengthens my point: It *does* has its merits, especially in your example, but its certainly not *better*. Just different functionality for different purpose.Craig wrote:It depends on what you are trying to achieve, If for example you wanted to shift the map to the above castle and display it large enough to take up most of the map you can do so with setViewArea() despite what the map windows dimensions are.
Any animation would really have to be part of the setZoom()/setViewArea() etc, a delay(x) macro will be problematic because delaying macros for 10 seconds would require pausing most of maptool for 10 seconds (I think that also includes gui responding).
2. i would expect the delay to hold MT entirely and I don't mind, actually it would be quite useful. Again here too it would be nice to have some sort of delayThread() and delayAll() where you can choose between delaying just that thread or maptool entirely, but I'm guessing the former is close to impossible. For the animation though *ANY* delay function is welcome, whether it halts MT entirely or not.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: FEATURE: updateView()
If I remember correctly --and I may not-- it all runs on the GUI thread, so responding to windowing system events will pause, meaning the windowing system will put up those "MapTool is not responding" type messageswolph42 wrote:[2. i would expect the delay to hold MT entirely and I don't mind, actually it would be quite useful. Again here too it would be nice to have some sort of delayThread() and delayAll() where you can choose between delaying just that thread or maptool entirely, but I'm guessing the former is close to impossible. For the animation though *ANY* delay function is welcome, whether it halts MT entirely or not.
And sorry I wasn't suggesting this function instead of another one but as well as
Re: FEATURE: updateView()
no worries, I already have one in the BoT. Its also a 'nice to have' but when using the BoT its a present function (bot_delay(ms) IRC)Craig wrote:If I remember correctly --and I may not-- it all runs on the GUI thread, so responding to windowing system events will pause, meaning the windowing system will put up those "MapTool is not responding" type messageswolph42 wrote:[2. i would expect the delay to hold MT entirely and I don't mind, actually it would be quite useful. Again here too it would be nice to have some sort of delayThread() and delayAll() where you can choose between delaying just that thread or maptool entirely, but I'm guessing the former is close to impossible. For the animation though *ANY* delay function is welcome, whether it halts MT entirely or not.
And sorry I wasn't suggesting this function instead of another one but as well as
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: FEATURE: setViewArea()
I would be more interested in a deferred macro call delay. Ie call macroX in Y seconds. My current method is to get the current time, pass it to a recursive deferred macro along with the time to execute and macrolink. Having it as a part of execLink would more convenient and less complicated.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: FEATURE: setViewArea()
After quickly diving into the code during my lunch time it looks as though this is essentially what the "Enforce GM view" function (ZoneRenderer.enforceView) does.
So in theory we could make a scripted version relatively easily. Hopefully I will have something for you to play with soon
So in theory we could make a scripted version relatively easily. Hopefully I will have something for you to play with soon
- JamzTheMan
- Great Wyrm
- Posts: 1872
- Joined: Mon May 10, 2010 12:59 pm
- Location: Chicagoland
- Contact:
Re: FEATURE: setViewArea()
Which is probably used by the Menu option, "Center Players on current view" under Tool menu.
So basically you are creating a macro function to emulate the menu function, no?
So basically you are creating a macro function to emulate the menu function, no?
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
Re: FEATURE: setViewArea()
Sort of, it would only set the view of the client that ran the script. It would not force all clients to the same view.
- JamzTheMan
- Great Wyrm
- Posts: 1872
- Joined: Mon May 10, 2010 12:59 pm
- Location: Chicagoland
- Contact:
Re: FEATURE: setViewArea()
Well, that's the next question, should we have a parameter for functions like these to automatically run on all connected clients?
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork