Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

experimental tilesize support

  • Loading branch information...
commit b079e4628e847ffd2e58d58adf2195fdaf73e26a 1 parent 9106c97
@springmeyer springmeyer authored
View
51 assets/css/controls.css
@@ -29,7 +29,8 @@
.wax-tooltip .close,
.wax-fullscreen,
-.zoomer {
+.zoomer,
+.scaler {
text-indent:-9999px;
overflow:hidden;
display:block;
@@ -62,7 +63,8 @@
}
.wax-fullscreen,
-.zoomer {
+.zoomer,
+.scaler {
left:10px;
top:10px;
z-index:2;
@@ -74,19 +76,6 @@
-webkit-box-shadow:rgba(0,0,0,0.1) 0px 1px 3px;
}
-
-@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
- only screen and (-o-min-device-pixel-ratio: 3/2),
- only screen and (min--moz-device-pixel-ratio: 1.5),
- only screen and (min-device-pixel-ratio: 1.5) {
- .wax-tooltip .close,
- .wax-fullscreen,
- .zoomer {
- background-image:url(../images/controls_2x.png);
- background-size: 120px 30px;
- }
-}
-
.zoomout {
background-position:-61px -1px;
border-radius:3px 0px 0px 3px;
@@ -107,6 +96,17 @@
-webkit-border-radius:0px 3px 3px 0px;
}
+.scaler {
+ left:68px;
+ }
+ .scaler.scale-retina {
+ background-position: -121px -1px;
+ }
+ .scaler.scale-normal {
+ background-position: -151px -1px;
+ }
+
+
.zoombox-box {
margin:0;
padding:0;
@@ -147,3 +147,24 @@
-webkit-border-radius:0px 0px 3px 3px;
}
+
+@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
+ only screen and (-o-min-device-pixel-ratio: 3/2),
+ only screen and (min--moz-device-pixel-ratio: 1.5),
+ only screen and (min-device-pixel-ratio: 1.5) {
+ .wax-tooltip .close,
+ .wax-fullscreen,
+ .zoomer,
+ .scaler {
+ background-image:url(../images/controls_2x.png);
+ background-size: 180px 30px;
+ }
+
+ .wax-fullscreen {
+ left:97px;
+ }
+
+ .zoom-display {
+ width:117px;
+ }
+}
View
3  assets/css/style.css
@@ -16,7 +16,7 @@
/* It would be great if we could apply this style to selects too, but a bug
- in Safari prevents us unfortunately. See
+ in Safari prevents us unfortunately. See
http://redrata.com/2011/07/safari-woff-select-field-crash/ */
input,
textarea,
@@ -985,6 +985,7 @@ li:hover .icon { display:block; }
.icon.eye { background-position:-640px -180px; }
.icon.upload { background-position:-680px -180px; }
.icon.inspect { background-position:-720px -180px; }
+.icon.inspect { background-position:-720px -180px; }
.reverse.edit { background-position:0px -200px; }
.reverse.inspect { background-position:-20px -200px; }
View
BIN  assets/images/controls.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
50 assets/images/controls.svg
@@ -9,11 +9,11 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="120"
+ width="180"
height="30"
id="svg3025"
version="1.1"
- inkscape:version="0.48.1 r9760"
+ inkscape:version="0.48.2 r9819"
sodipodi:docname="controls.svg"
inkscape:export-filename="/home/devseed/pro/node_modules/tilestream/assets/images/controls.png"
inkscape:export-xdpi="90"
@@ -28,18 +28,46 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
- inkscape:cx="-100.34729"
- inkscape:cy="-26.5937"
+ inkscape:cx="146.4977"
+ inkscape:cy="13.336927"
inkscape:document-units="px"
inkscape:current-layer="layer1"
- showgrid="false">
+ showgrid="true"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:window-width="1379"
+ inkscape:window-height="856"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid3033"
empspacing="5"
visible="true"
enabled="true"
- snapvisiblegridlinesonly="true" />
+ snapvisiblegridlinesonly="true"
+ dotted="true" />
+ <sodipodi:guide
+ orientation="1,0"
+ position="30,50"
+ id="guide2987" />
+ <sodipodi:guide
+ orientation="1,0"
+ position="60,25"
+ id="guide2989" />
+ <sodipodi:guide
+ orientation="1,0"
+ position="90,25"
+ id="guide2991" />
+ <sodipodi:guide
+ orientation="1,0"
+ position="120,25"
+ id="guide2993" />
+ <sodipodi:guide
+ orientation="1,0"
+ position="150,25"
+ id="guide3004" />
</sodipodi:namedview>
<metadata
id="metadata3030">
@@ -82,5 +110,15 @@
id="path6407"
d="m 110,1032.3622 0,5 -2,-2 -5,5 2,2 -5,0 0,-5 2,2 5,-5 -2,-2 z"
style="color:#000000;fill:#202020;fill-opacity:0.87843137;fill-rule:nonzero;stroke:none;stroke-width:0.99999994;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#202020;fill-opacity:1;stroke:none"
+ d="m 169,1031.3622 0,2 -2,0 0,2 -2,0 0,2 -2,0 0,2 -2,0 0,2 -2,0 0,2 12,0 0,-2 0,-2 0,-2 0,-2 0,-2 0,-2 -2,0 z"
+ id="rect4931" />
+ <path
+ style="fill:#202020;fill-opacity:1;stroke:none"
+ d="m 129,1043.3622 12,-12 0,12 z"
+ id="path5118"
+ inkscape:connector-curvature="0" />
</g>
</svg>
View
BIN  assets/images/controls_2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  assets/images/spinner-reverse.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  assets/images/spinner.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  assets/images/sprite.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
73 assets/images/sprite.svg
@@ -14,7 +14,7 @@
height="480"
id="svg2"
sodipodi:version="0.32"
- inkscape:version="0.48.3.1 r9886"
+ inkscape:version="0.48.2 r9819"
version="1.0"
sodipodi:docname="sprite.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
@@ -6046,20 +6046,20 @@
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="1.4142136"
- inkscape:cx="442.29962"
- inkscape:cy="298.48619"
+ inkscape:zoom="16"
+ inkscape:cx="717.69912"
+ inkscape:cy="273.68736"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:snap-bbox="true"
showguides="true"
inkscape:guide-bbox="true"
- inkscape:window-width="1343"
- inkscape:window-height="715"
- inkscape:window-x="10"
- inkscape:window-y="24"
- inkscape:window-maximized="0"
+ inkscape:window-width="1377"
+ inkscape:window-height="856"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
inkscape:snap-nodes="true"
inkscape:bbox-nodes="false"
inkscape:snap-bbox-edge-midpoints="false"
@@ -6096,14 +6096,6 @@
orientation="1,0"
position="380,495"
id="guide9998" />
- <sodipodi:guide
- orientation="1,0"
- position="700,213.35373"
- id="guide3984" />
- <sodipodi:guide
- orientation="1,0"
- position="720,197.59781"
- id="guide3986" />
</sodipodi:namedview>
<metadata
id="metadata7">
@@ -6113,25 +6105,11 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
+ <dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
- inkscape:groupmode="layer"
- id="layer2"
- inkscape:label="Ground"
- style="display:none"
- sodipodi:insensitive="true">
- <rect
- style="opacity:0.98999999;color:#000000;fill:#a3a3a3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- id="rect4961"
- width="800"
- height="480"
- x="0"
- y="0" />
- </g>
- <g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
@@ -7215,5 +7193,36 @@
style="fill:#ffffff;fill-opacity:1"
d="m 725,124 c -0.554,0 -1,0.446 -1,1 l 0,2 2.5,0 5,0 4.5,0 0,-2 c 0,-0.554 -0.446,-1 -1,-1 l -10,0 z m -1,4 0,2 2,0 0,-2 -2,0 z m 3,0 0,2 4,0 0,-2 -4,0 z m 5,0 0,2 4,0 0,-2 -4,0 z m -8,3 0,2 2,0 0,-2 -2,0 z m 3,0 0,2 4,0 0,-2 -4,0 z m 5,0 0,2 4,0 0,-2 -4,0 z m -8,3 0,1 c 0,0.554 0.446,1 1,1 l 1,0 0,-2 -2,0 z m 3,0 0,2 4,0 0,-2 -4,0 z m 5,0 0,2 3,0 c 0.554,0 1,-0.446 1,-1 l 0,-1 -4,0 z"
id="rect4871-2" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#202020;fill-opacity:1;stroke:none"
+ d="m 774,104 0,2 -2,0 0,2 -2,0 0,2 -2,0 0,2 -2,0 0,2 -2,0 0,2 12,0 0,-2 0,-2 0,-2 0,-2 0,-2 0,-2 -2,0 z"
+ id="rect4931" />
+ <path
+ id="path5094"
+ d="m 775,124 0,2 -2,0 0,2 -2,0 0,2 -2,0 0,2 -2,0 0,2 -2,0 0,2 12,0 0,-2 0,-2 0,-2 0,-2 0,-2 0,-2 -2,0 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#202020;fill-opacity:1;stroke:none"
+ d="m 744,116 12,-12 0,12 z"
+ id="path5118"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path5122"
+ d="m 744,136 12,-12 0,12 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none" />
+ <path
+ id="path4737"
+ d="m 710,125 c -4,0 -5,3 -8,5 1.16821,0.7788 2.0181,1.71661 2.875,2.5625 L 707.0625,130.5 C 707.03382,130.33342 707,130.17477 707,130 c 0,-1.65687 1.34313,-3 3,-3 0.21746,0 0.42067,0.0186 0.625,0.0625 l 1.71875,-1.625 C 711.67688,125.16516 710.92678,125 710,125 z m 4.84375,2.1875 -2,1.9375 C 712.9314,129.40682 713,129.68934 713,130 c 0,1.65687 -1.34313,3 -3,3 -0.35554,0 -0.68353,-0.074 -1,-0.1875 l -1.6875,1.59375 C 708.05778,134.77039 708.91076,135 710,135 c 4,0 5,-3 8,-5 -1.2909,-0.8606 -2.20762,-1.90028 -3.15625,-2.8125 z"
+ style="opacity:0.59999999999999998;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.05500000000000000;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ inkscape:connector-curvature="0" />
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0"
+ id="path4739"
+ d="m 715.5,124.5 -11,10.5"
+ style="fill:none;stroke:#ffffff;stroke-width:1.25000000000000000;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</svg>
View
BIN  assets/images/sprite_2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  assets/images/tilemill.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  assets/images/tilemill_2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
14 servers/Tile.bones
@@ -40,14 +40,22 @@ server.prototype.load = function(req, res, next) {
// contains the mtime with _updated.
var load = this.load;
var id = req.params.id;
+ var tileSize = 256;
+ var scale = (req.project && req.project.attributes.scale) || 1;
+ if (req.query.scale) {
+ scale *= parseFloat(req.query.scale);
+ tileSize *= parseFloat(req.query.scale);
+ }
+
var uri = {
protocol: 'mapnik:',
slashes: true,
pathname: path.join(settings.files, 'project', id, id + '.xml'),
query: {
- updated:req.query.updated,
- scale: req.project && req.project.attributes.scale,
- metatile: req.project && req.project.attributes.metatile
+ updated: req.query.updated,
+ scale: scale,
+ metatile: req.project && req.project.attributes.metatile,
+ tileSize: tileSize
},
// Need not be set for a cache hit. Once the cache is
// warmed the project need not be loaded/localized again.
View
38 views/Map.bones
@@ -1,3 +1,18 @@
+function scaler(map) {
+ return {
+ scale: window.devicePixelRatio,
+ el: $('<a href="#" class="scaler scale-normal">retina</a>'),
+ toggle: function() {
+ this.scale = this.scale == 1 ? window.devicePixelRatio : 1;
+ },
+ appendTo: function(target) {
+ this.el.appendTo(target);
+ return this;
+ }
+ };
+}
+
+
view = Backbone.View.extend();
view.prototype.initialize = function() {
@@ -32,6 +47,8 @@ view.prototype.render = function(init) {
}
}
+ var scaleControl = scaler(this.map);
+
// Add references to all controls onto the map object.
// Allows controls to be removed later on.
this.map.controls = {
@@ -44,9 +61,23 @@ view.prototype.render = function(init) {
legend: wax.mm.legend(this.map, this.model.attributes),
zoombox: wax.mm.zoombox(this.map),
zoomer: wax.mm.zoomer(this.map).appendTo(this.map.parent),
- fullscreen: wax.mm.fullscreen(this.map).appendTo(this.map.parent)
+ fullscreen: wax.mm.fullscreen(this.map).appendTo(this.map.parent),
+ scaler: scaleControl.appendTo(this.map.parent)
};
+ var view = this;
+ this.map.controls.scaler.el.click(function(e) {
+ scaleControl.toggle();
+ if (scaleControl.scale == 1) {
+ scaleControl.el.removeClass('scale-normal').addClass('scale-retina');
+ } else {
+ scaleControl.el.removeClass('scale-retina').addClass('scale-normal');
+ }
+ view.attach();
+ return false;
+ });
+
+
// Add image error request handler. "Dedupes" image errors by
// checking against last received image error so as to not spam
// the user with the same errors message for every image request.
@@ -96,7 +127,10 @@ view.prototype.attach = function() {
this._error = '';
var layer = this.map.getLayerAt(0);
- layer.provider.options.tiles = this.model.get('tiles');
+ var scale = this.map.controls.scaler.scale;
+ layer.provider.options.tiles = _.map(this.model.get('tiles'), function(url) {
+ return url + '&scale=' + scale;
+ });
layer.provider.options.minzoom = this.model.get('minzoom');
layer.provider.options.maxzoom = this.model.get('maxzoom');
layer.setProvider(layer.provider);
Please sign in to comment.
Something went wrong with that request. Please try again.