如何实现与 Seatgeek 一样的可缩放可拖动界面?

发布于 2024-12-27 13:59:39 字数 524 浏览 6 评论 0原文

Seatgeek 有一个可缩放、可拖动的平铺界面。

一个例子在这里: http://seatgeek.com/sf-bulls-yankees-tickets/3-2-2012-tampa-george-steinbrenner-field/mlb/785875/#

我想实现一个像这样的可滚动可拖动界面,但我无法使用谷歌地图的谷歌代码。 我还需要像谷歌地图这样的图块系统,它从服务器中提取图块来渲染地图。 需要用javascript来实现。我可以使用什么库?我该怎么做呢? Seatgeek是如何做到的?


我反编译了他们的javascript http://pastebin.com/PVjahhnH

Seatgeek has a zoomable draggable tiled interface.

An example is here:
http://seatgeek.com/sf-bulls-yankees-tickets/3-2-2012-tampa-george-steinbrenner-field/mlb/785875/#

I want to implement a scrollable draggable interface like this but I cannot use Google's code for google maps.
Also I need the tile system like google maps where it pulls tiles from the server for rendering the map.
Need to implement in javascript. What library can I use? How can I do it?
How does seatgeek do it?


I de-compiled their javascript http://pastebin.com/PVjahhnH

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

岁月流歌 2025-01-03 13:59:39

这种接口实现起来看似复杂,但其实只是一些数学技巧。如果您决定实现自己的算法,请尝试以下操作:

  1. 获取完整图像并创建不同比例并因此具有不同深度的图块。
  2. 用户开始查看真实比例的场景,该场景由根据原始场景创建的 16 个图块组成。
    如果用户拖动,所有图块都会同等移动。如果用户放大,所有图块都会放大。
  3. 如果用户缩放超过 X,您将通过 16 个子图块更改 16 个图块!知道了?变焦越高,细节越高。为了避免同时出现 36000 个图块,请生成不同的深度并动态切换它们。

您只需要加载并移动瓷砖即可。将平铺 x、y、宽度、高度乘以缩放。将场景焦点保持在鼠标位置。看一下这个示例。它完全执行上述步骤,但带有大量显微镜图像。这与谷歌地图的想法相同。

This kind of interface seems complex to implement, but it is just some math tricks. If you decide to implement your own algorithm, try this out:

  1. Take the full image and create tiles in different scales and consequently with different depth.
  2. The user start looking at the scene in real scale, composed by 16 tiles created from the original scene.
    If the user drags, all tiles moves equaly. If the user zoom in, all tiles are scaled up.
  3. If the user zoom more than X, you change the 16 tiles by their 16 child tiles! Got it? Higher the zoom, higher the detail. To avoid having 36000 tiles at the same time, generate with different depth and switch them on the fly.

You just need to load and move the tiles. Multiply tile x, y, width, height by the zoom. Keep the focus of the scene in the mouse position. Take a look at this example. It does exactly the steps above, but with a lot of microscope images. It is the same idea of google maps.

蓝颜夕 2025-01-03 13:59:39

CloudMade 地图瓦片是基于服务器的地图瓦片服务之一。请阅读此页面服务器 http://cloudmade.com/documentation/map-tiles 或联系[电子邮件受保护]了解更多信息。

CloudMade map tile is one of the server based map tile service. Please read this page server http://cloudmade.com/documentation/map-tiles or contact with [email protected] for more information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文