Map Zoom

by Kaiochao
Let players zoom in and out of your map. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Kaiochao.MapZoom##version=2

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Kaiochao.MapZoom##version=2

190 downloads
Version 2
Date added: Aug 6 2015
Last updated: Aug 7 2015
5 fans
Changes
  • 7 August 2015
    • Moved demo code to be included in every project, making this library plug-and-play. Just check the box next to this library in your Lib folder and it should work.
    • Added a zoom-level of 0, Stretch to Fit. It lives as the first, default zoom level.

Run the demo to see it in action. When you create a /map_zoom object, make sure to pass it the client you want it to affect.

You can specify the levels of zoom to go through. By default, it's 100%, 125%, 150%, 175%, 200%, 250%, 300%, then 400%. You call map_zoom.ZoomIn() to go up that series, and ZoomOut() to go down.

You can also specify the smoothing factor of the zoom to gradually, smoothly go between zoom levels. This is the map_zoom.zoom_smoothing variable. You can disable smoothing by setting to 1, or disable zooming by setting it to 0.

This library should automatically affect your default map control. If for some reason it's not working, you can set the map_zoom.map_id to your map control's ID as shown in the skin editor.

This library will never change your client and world.view variables.

Demo controls:

Keyboard!
  • Ctrl+Plus: Zoom In
  • Ctrl+Minus: Zoom Out
Mouse!
  • Ctrl+ScrollUp: Zoom In
  • Ctrl+ScrollDown: Zoom Out

*Note: Scroll detection is a feature of 508.1287 beta. It won't work in earlier versions.

Comments

Kaiochao: (Aug 9 2015, 5:41 pm)
AERProductions wrote:
Is it possible to clean up the black-flashing while zooming in and out? The first time I tried it, it wasn't as bad but it seems to of gotten worse.

The black-flashing didn't always happen in previous BYOND versions, so I'm considering it a BYOND bug.

Bug Report
AERProductions: (Aug 9 2015, 10:35 am)
Is it possible to clean up the black-flashing while zooming in and out? The first time I tried it, it wasn't as bad but it seems to of gotten worse.

I am using the beta (508.1294).
AERProductions: (Aug 7 2015, 6:00 pm)
Kaiochao wrote:
Sorry, the demo requires my shapes library. I figured it would download it automatically, unless you downloaded the Zip. Anyway, it's a good library for... any project. ;)

Yeah I figured that was the issue. I will report back with the results.

EDIT: Good Stuff, works in pondera and consider it added to the project I will put you in the credits. :)
Kaiochao: (Aug 7 2015, 5:59 pm)
Sorry, the demo requires my shapes library. I figured it would download it automatically, unless you downloaded the Zip. Since it's included by the demo, it won't be included in your games that include this library.

Anyway, shape is a good library for... any project. ;)
AERProductions: (Aug 7 2015, 5:45 pm)
I am going to try this in pondera.
By the way, got this error when compiling with the demo:
demo\demo.dm:1:error: unable to open <kaiochao\shapes\shapes.dme>.