Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapillary js #3128

Merged
merged 14 commits into from Jun 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Expand Up @@ -63,7 +63,8 @@
"osmAuth": false,
"sexagesimal": false,
"toGeoJSON": false,
"marked": false
"marked": false,
"Mapillary": false,
},

"env": {
Expand Down
78 changes: 41 additions & 37 deletions css/app.css
Expand Up @@ -660,45 +660,8 @@ button.save.has-count .count::before {
bottom: 0;
}

.mapillary-image {
position: absolute;
bottom: 30px;
width: 330px;
height: 250px;
padding: 5px;
background-color: #fff;
}

.mapillary-image a {
display: block;
position: absolute;
height: auto;
background-color: rgba(0,0,0,.5);
bottom: 0;
padding: 5px 10px;
}

.mapillary-image img {
width: 100%;
height: auto;
display: block;
}

.mapillary-image.hidden {
visibility: hidden;
}

.mapillary-image.temp button {
display: none;
}

.mapillary-image button {
border-radius: 0;
padding: 5px;
position: absolute;
right: 0;
top: 0;
}

.feature-list-pane .inspector-body {
top: 120px;
Expand Down Expand Up @@ -3293,3 +3256,44 @@ img.tile-removing {
background: rgba(0, 0, 0, 0) url(img/iD-sprite.svg) no-repeat -300px -460px;
margin: auto;
}

/* Mapillary
------------------------------------------------------- */
.mapillary-wrap {
position: absolute;
bottom: 30px;
width: 330px;
height: 250px;
padding: 5px;
background-color: #fff;
}

.mapillary-wrap.hidden {
visibility: hidden;
}

.mapillary-wrap .uil-ripple-css {
top: -9px;
left: -15px;
}

.mapillary-wrap .uil-ripple-css div {
top: 38px;
}

.mapillary-wrap button.thumb-hide {
border-radius: 0;
padding: 5px;
position: absolute;
right: 0;
top: 0;
z-index: 500;
}

.mly-wrapper {
visibility: hidden;
}

.mly-wrapper.active {
visibility: visible;
}
16 changes: 16 additions & 0 deletions css/map.css
Expand Up @@ -1519,6 +1519,22 @@ text.gpx {
z-index: 60;
}

.layer-mapillary-images .viewfield-group.loading * {
stroke-width: 2;
stroke: #222;
fill: #ff9900;
z-index: 60;
animation-name: viewfield-group-loading;
animation-duration: 0.8s;
animation-iteration-count: infinite;
animation-direction: alternate;
}

@keyframes viewfield-group-loading {
from {fill: #ff9900;}
to {fill: #ff5800;}
}

.layer-mapillary-images .viewfield-group:hover path.viewfield,
.layer-mapillary-images .viewfield-group.selected path.viewfield,
.layer-mapillary-images .viewfield-group path.viewfield {
Expand Down
2 changes: 1 addition & 1 deletion data/core.yaml
Expand Up @@ -425,7 +425,7 @@ en:
tooltip: "Street-level photos from Mapillary"
title: "Photo Overlay (Mapillary)"
mapillary_signs:
tooltip: "Traffic signs from Mapillary"
tooltip: "Traffic signs from Mapillary (must enable Photo Overlay)"
title: "Traffic Sign Overlay (Mapillary)"
mapillary:
view_on_mapillary: "View this image on Mapillary"
Expand Down
2 changes: 2 additions & 0 deletions dist/index.html
Expand Up @@ -4,6 +4,7 @@
<meta charset='utf-8'>
<title>iD</title>
<link rel='stylesheet' href='iD.css'>
<link rel='stylesheet' href='mapillary/mapillary.css'>

<!-- mobile devices -->
<meta name='viewport' content='initial-scale=1.0 maximum-scale=1.0'>
Expand All @@ -14,6 +15,7 @@
<script src='iD.js'></script>
<script src='presets.js'></script>
<script src='imagery.js'></script>
<script src='mapillary/mapillary.js'></script>
<!--<![endif]-->
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/en.json
Expand Up @@ -512,7 +512,7 @@
"title": "Photo Overlay (Mapillary)"
},
"mapillary_signs": {
"tooltip": "Traffic signs from Mapillary",
"tooltip": "Traffic signs from Mapillary (must enable Photo Overlay)",
"title": "Traffic Sign Overlay (Mapillary)"
},
"mapillary": {
Expand Down
1 change: 0 additions & 1 deletion index.html
Expand Up @@ -32,7 +32,6 @@
<script src='js/lib/sexagesimal.js'></script>
<script src='js/lib/togeojson.js'></script>
<script src='js/lib/marked.js'></script>

<script src='js/id/id.js'></script>

<script src='js/id/util.js'></script>
Expand Down
57 changes: 45 additions & 12 deletions js/id/renderer/map.js
Expand Up @@ -11,6 +11,7 @@ iD.Map = function(context) {
redrawEnabled = true,
transformStart,
transformed = false,
easing = false,
minzoom = 0,
drawLayers = iD.svg.Layers(projection, context),
drawPoints = iD.svg.Points(projection, context),
Expand Down Expand Up @@ -110,7 +111,9 @@ iD.Map = function(context) {
drawLabels.supersurface(supersurface);
}

function pxCenter() { return [dimensions[0] / 2, dimensions[1] / 2]; }
function pxCenter() {
return [dimensions[0] / 2, dimensions[1] / 2];
}

function drawVector(difference, extent) {
var graph = context.graph(),
Expand Down Expand Up @@ -246,8 +249,7 @@ iD.Map = function(context) {

var timeoutId;
function queueRedraw() {
clearTimeout(timeoutId);
timeoutId = setTimeout(function() { redraw(); }, 300);
timeoutId = setTimeout(function() { redraw(); }, 750);
}

function pointLocation(p) {
Expand Down Expand Up @@ -420,20 +422,51 @@ iD.Map = function(context) {
return redraw();
};

map.centerEase = function(loc) {
var from = map.center().slice(),
t = 0,
stop;
map.centerEase = function(loc2, duration) {
duration = duration || 250;

surface.one('mousedown.ease', function() {
stop = true;
map.cancelEase();
});

if (easing) {
map.cancelEase();
}

var t1 = Date.now(),
t2 = t1 + duration,
loc1 = map.center(),
ease = d3.ease('cubic-in-out');

easing = true;

d3.timer(function() {
if (stop) return true;
map.center(iD.geo.interp(from, loc, (t += 1) / 10));
return t === 10;
}, 20);
if (!easing) return true; // cancelled ease

var tNow = Date.now();
if (tNow > t2) {
tNow = t2;
easing = false;
}

var locNow = iD.geo.interp(loc1, loc2, ease((tNow - t1) / duration));
setCenter(locNow);

d3.event = {
scale: zoom.scale(),
translate: zoom.translate()
};

zoomPan();
return !easing;
});

return map;
};

map.cancelEase = function() {
easing = false;
d3.timer.flush();
return map;
};

Expand Down