webbukkit / dynmap

A set of Minecraft mods that provide a real time web-based map system for various Minecraft server implementations.
https://www.reddit.com/r/Dynmap/
Apache License 2.0
2.06k stars 421 forks source link

Zooming in #1021

Closed awprice closed 11 years ago

awprice commented 11 years ago

When zooming in using Dynmap it does a weird loop thing. I have noticed it is more obvious as the mouse is further away from the centre of the screen. It seems semi like a style thing (as in for show) but is there a way of disabling it?

ntrixter commented 11 years ago

I am having the same problem. Its like the screen hops when it zooms in. Its very annoying.

mikeprimm commented 11 years ago

Map zoom is towards the location of the mouse on the map - this is as-designed.

awprice commented 11 years ago

Is there a way to disable it? Due to loading times of the tiles, it is often disorientating.

mikeprimm commented 11 years ago

Not at present, but let me give it a look

awprice commented 11 years ago

Thank you for that. Much appreciated. Any updates would be great.

awprice commented 11 years ago

Update: Seems as if it only occurs in Google Chrome. Tried it on Mozilla Firefox and Internet Explorer and it zoomed in normally, no weird loop zoom thing.

n4imLess commented 11 years ago

Yes I can confirm this only occurs in Google Chrome. (Version 23.0.1271.64 m).

awprice commented 11 years ago

Any updates? Would there be an option to disable it in an upcoming version?

SemperFu commented 11 years ago

Mike, the issue isn't with zooming toward the mouse. That is what we want. It however shifts to the side before zooming in. Firefox zooms smoothly. It is just a weird issue with Chrome, hurts the eyes.

JRichmond27 commented 11 years ago

Exactly what Jasin said... the final location of the map after zooming is fine. It's the transition that's not working correctly in Chrome.

Try zooming in or out on this map using Google Chrome: http://mc.g4m.es:8123/

stevewall85 commented 11 years ago

i have tested the map http://mc.g4m.es:8123/ and it dont work with chrome i cant zoom unless i us the zoom button and i cant move the map. Also i have tested this with internet explorer and after 1 mouse click of zoom it locks up

JRichmond27 commented 11 years ago

Sounds like stevewall might be having a separate issue. The problem we're having is purely with the zoom transition effect. The mousewheel zooming works fine for me anyway, and it has never locked up on me.

mikeprimm commented 11 years ago

Guys - I'm working on a major version update for the mapping library we use, which is the code responsible for all of this. Unfortunately, the code changed a lot since my last update, so its driving a lot of rewrite.

JRichmond27 commented 11 years ago

Awesome... thanks for the update!

mikeprimm commented 11 years ago

All good - it will NOT be in the 1.3 GA, which I'm planning on pushing today. But, I expect it to be the first major action for 1.4, so watch for the development builds and alphas.

SemperFu commented 11 years ago

Thank you Sir, Look forward to it.

SemperFu commented 11 years ago

I just installed 1.4 Dev and same zoom issue (and same nether issue even after multiple fullrenders) Is there something I need to change in the config?

jtdaugherty commented 11 years ago

I can confirm that this issue still affects Google Chrome with dynmap verison 1.5-593.

SordX commented 11 years ago

The problem is in the leaflet.js library. Dynmap is using leaflet 0.3 version. I changed two functions to nearly match the current leaflet 0.5.1 versions and it appears to be working fine for me in Chrome.

[edit]see mikeprimm's comment below which makes these code changes irrelevant[/edit]

getScaleString: function (scale, origin) {
    var preTranslateStr = L.DomUtil.getTranslateString(origin.add(origin.multiplyBy(-1*scale))),
        scaleStr = ' scale(' + scale + ') ';

    return preTranslateStr + scaleStr;
},

and

_runAnimation: function (center, zoom, scale, origin) {
    this._animateToCenter = center;
    this._animateToZoom = zoom;
    this._animatingZoom = true;

    var transform = L.DomUtil.TRANSFORM;

    clearTimeout(this._clearTileBgTimer);

    L.Util.falseFn(this._tileBg.offsetWidth); //hack to make sure transform is updated before running animation

    var scaleStr = L.DomUtil.getScaleString(scale, origin);

    var options = {};
    options[transform] = this._tileBg.style[transform] + ' ' + scaleStr;
    this._tileBg.transition.run(options);
},

Note that leaflet.js is a packed library and the previous functions are the unpacked leaflet_src.js versions. I put a copy of my modified leaflet-src.js online. You'll need to rename it to leaflet.js and replace the file in the dynmap/web/js directory.

mikeprimm commented 11 years ago

You guys should give the 1.6-alpha-2 a try - we updated Leaflet in 1.6-alpha-1, and alpha-2 includes some additional fixes for problems that popped up due to the move to the new Leaflet.

SordX commented 11 years ago

Excellent! I installed 1.6-alpha-2 and it appears to be working correctly in Chrome.

mikeprimm commented 11 years ago

Fix released in 1.6