Skip to content

Commit

Permalink
All graphics from iD-sprite are now symbols that can be used
Browse files Browse the repository at this point in the history
(re: #3924)
  • Loading branch information
bhousel committed Mar 24, 2017
1 parent 09d3e2d commit 02e5ae4
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 93 deletions.
78 changes: 28 additions & 50 deletions css/80_app.css
Original file line number Diff line number Diff line change
Expand Up @@ -2420,6 +2420,7 @@ div.full-screen > button:hover {
margin-top: 10px;
border-bottom: 1px solid #ccc;
border-radius: 4px;
text-align: center;
}

.help-wrap .nav {
Expand Down Expand Up @@ -3016,20 +3017,14 @@ img.tile-removing {
background-color: #ececec;
}

.modal-actions button:before,
.save-success a.button.osm:before,
.walkthrough a:before {
display: block;
content: '';
.logo {
height: 100px;
width: 100%;
max-width: 100px;
margin: auto;
margin-bottom: 10px;
background:transparent url(img/iD-sprite.svg) no-repeat -200px -460px;
}

.modal-actions :first-child {
.modal-actions > :first-child {
border-right: 1px solid #CCC;
}

Expand All @@ -3039,57 +3034,48 @@ img.tile-removing {

/* Restore Modal
------------------------------------------------------- */

.modal-actions .restore:before {
background-position: -500px -460px;
.modal-actions .logo-restore {
color: #7092FF;
}

.modal-actions .reset:before {
background-position: -600px -460px;
.modal-actions .logo-reset {
color: #E06C5E;
}

/* Success Modal
------------------------------------------------------- */

.save-success p {
padding: 15px 15px 0 15px;
}
.save-success a.details {
padding-left: 15px;
padding-left: 15px;
}
.save-success .button {
padding-top: 15px;
}

.save-success .logo-osm {
color: #7092FF;
margin-bottom: 10px;
}
.save-success a.button.social {
height: auto;
border-bottom: none;
}

.save-success .icon.social {
height: 80px;
width: 80px;
color: #7092FF;
}

.save-success .button.osm:before {
background-position: -200px -460px;
}

/* Splash Modal
------------------------------------------------------- */

.modal-actions .walkthrough:before,
.walkthrough a:before {
background-position: -300px -460px;
.modal-actions .logo-walkthrough,
.modal-actions .logo-features {
color: #7092FF;
}

.modal-actions .start:before {
background-position: -400px -460px;
}

/* Commit Modal
/* Save Mode
------------------------------------------------------- */

.mode-save a.user-info {
display: inline-block;
}
Expand Down Expand Up @@ -3452,6 +3438,13 @@ img.tile-removing {
.add-point .tooltip .tooltip-arrow {
left: 60px;
}
[dir='rtl'] .add-point .tooltip .tooltip-arrow {
left: auto;
right: 60px;
}
[dir='rtl'] .curtain-tooltip.intro-points-add .tooltip-arrow {
left: 50%;
}

/* radial menu (deprecated) */

Expand Down Expand Up @@ -3656,25 +3649,11 @@ img.tile-removing {
top: 133px !important;
}

/* Tooltip illustrations */

.intro-points-add .tooltip-inner::before,
.intro-areas-add .tooltip-inner::before,
.intro-lines-add .tooltip-inner::before {
margin-left: -20px;
display: block;
content: "";
.tooltip-illustration {
height: 80px;
width: 200px;
background:transparent url(img/iD-sprite.svg) no-repeat 0 -320px;
}

.intro-areas-add .tooltip-inner::before {
background-position: 0 -400px;
}

.intro-lines-add .tooltip-inner::before {
background-position: 0 -480px;
margin-left: -20px;
margin-top: -10px;
}

.huge-modal-button {
Expand All @@ -3686,8 +3665,7 @@ img.tile-removing {
.huge-modal-button .illustration {
height: 100px;
width: 100px;
background: rgba(0, 0, 0, 0) url(img/iD-sprite.svg) no-repeat -300px -460px;
margin: auto;
color: #7092FF;
}

.mapillary-wrap {
Expand Down
23 changes: 18 additions & 5 deletions modules/ui/curtain.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ export function uiCurtain() {
}


curtain.reveal = function(box, text, tooltipclass, duration) {
curtain.reveal = function(box, text, options) {
if (typeof box === 'string') box = d3.select(box).node();
if (box.getBoundingClientRect) box = box.getBoundingClientRect();

curtain.cut(box, duration);
options = options || {};
curtain.cut(box, options.duration);

if (text) {
// pseudo markdown bold text hack
Expand Down Expand Up @@ -104,26 +105,38 @@ export function uiCurtain() {
Math.min(Math.max(10, pos[1]), h - dimensions[1] - 10)
];

if (duration !== 0 || !tooltip.classed(side)) {
if (options.duration !== 0 || !tooltip.classed(side)) {
tooltip.call(uiToggle(true));
}

tooltip
.style('top', pos[1] + 'px')
.style('left', pos[0] + 'px')
.attr('class', 'curtain-tooltip tooltip in ' + side + ' ' + tooltipclass);
.attr('class', 'curtain-tooltip tooltip in ' + side + ' ' + (options.tooltipClass || ''));

} else {
tooltip.call(uiToggle(false));
}

return tooltip;
};


curtain.cut = function(datum, duration) {
darkness.datum(datum)
.interrupt();

(duration === 0 ? darkness : darkness.transition().duration(duration || 600))
var selection;
if (duration === 0) {
selection = darkness;
} else {
selection = darkness
.transition()
.duration(duration || 600)
.ease(d3.easeLinear);
}

selection
.attr('d', function(d) {
var string = 'M 0,0 L 0,' + window.innerHeight + ' L ' +
window.innerWidth + ',' + window.innerHeight + 'L' +
Expand Down
17 changes: 14 additions & 3 deletions modules/ui/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,23 @@ export function uiHelp(context) {
.html(function(d) { return d.title; })
.on('click', clickHelp);

toc.append('li')
.attr('class','walkthrough')
var walkthrough = toc
.append('li')
.attr('class', 'walkthrough')
.append('a')
.text(t('splash.walkthrough'))
.on('click', clickWalkthrough);

walkthrough
.append('svg')
.attr('class', 'logo logo-walkthrough')
.append('use')
.attr('xlink:href', '#logo-walkthrough');

walkthrough
.append('div')
.text(t('splash.walkthrough'));


var content = pane.append('div')
.attr('class', 'left-content');

Expand Down
11 changes: 8 additions & 3 deletions modules/ui/intro/area.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ export function uiIntroArea(context, reveal) {


function addArea() {
reveal('button.add-area',
t('intro.areas.add', { button: icon('#icon-area', 'pre-text') }),
{ tooltipClass: 'intro-areas-add' });
var tooltip = reveal('button.add-area',
t('intro.areas.add', { button: icon('#icon-area', 'pre-text') }));

tooltip.selectAll('.tooltip-inner')
.insert('svg', 'span')
.attr('class', 'tooltip-illustration')
.append('use')
.attr('xlink:href', '#landuse-images');

context.on('enter.intro', startArea);
}
Expand Down
22 changes: 9 additions & 13 deletions modules/ui/intro/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { t } from '../../util/locale';
import { localNames } from './helper';

import { coreGraph } from '../../core/graph';
import { dataIntroGraph } from '../../../data/intro_graph.json';
import { modeBrowse } from '../../modes/browse';
import { osmEntity } from '../../osm/entity';
import { dataIntroGraph } from '../../../data/intro_graph.json';
import { svgIcon } from '../../svg/icon';
import { uiCurtain } from '../curtain';

import { uiIntroNavigation } from './navigation';
Expand Down Expand Up @@ -39,7 +40,7 @@ export function uiIntro(context) {
// create entities for intro graph and localize names
for (var key in dataIntroGraph) {
introGraph[key] = osmEntity(dataIntroGraph[key]);
var name = localNames[id] && t('intro.graph.' + localNames[id]);
var name = localNames[key] && t('intro.graph.' + localNames[key]);
if (name) {
introGraph[key].tags.name = name;
}
Expand Down Expand Up @@ -75,7 +76,7 @@ export function uiIntro(context) {
selection.call(curtain);

var chapters = chapterFlow.map(function(chapter, i) {
var s = chapterUi[chapter](context, reveal)
var s = chapterUi[chapter](context, curtain.reveal)
.on('done', function() {
entered.filter(function(d) {
return d.title === s.title;
Expand All @@ -102,6 +103,11 @@ export function uiIntro(context) {
.append('div')
.attr('class', 'intro-nav-wrap fillD');

// navwrap
// .append('div')
// .attr('class', 'intro-nav-wrap-icon fillD')
// .call(svgIcon('#logo-walkthrough', 'pre-text light'));

var buttonwrap = navwrap
.append('div')
.attr('class', 'joined')
Expand All @@ -126,16 +132,6 @@ export function uiIntro(context) {
enter(chapters[0]);


function reveal(box, text, options) {
options = options || {};
curtain.reveal(box,
text || '',
options.tooltipClass || '',
options.duration
);
}


function enter(newChapter) {
if (currChapter) { currChapter.exit(); }

Expand Down
11 changes: 8 additions & 3 deletions modules/ui/intro/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ export function uiIntroLine(context, reveal) {


function addLine() {
reveal('button.add-line',
t('intro.lines.add', { button: icon('#icon-line', 'pre-text') }),
{ tooltipClass: 'intro-lines-add' });
var tooltip = reveal('button.add-line',
t('intro.lines.add', { button: icon('#icon-line', 'pre-text') }));

tooltip.selectAll('.tooltip-inner')
.insert('svg', 'span')
.attr('class', 'tooltip-illustration')
.append('use')
.attr('xlink:href', '#feature-images');

context.on('enter.intro', startLine);
}
Expand Down
8 changes: 7 additions & 1 deletion modules/ui/intro/point.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ export function uiIntroPoint(context, reveal) {


function addPoint() {
reveal('button.add-point',
var tooltip = reveal('button.add-point',
t('intro.points.add', { button: icon('#icon-point', 'pre-text') }),
{ tooltipClass: 'intro-points-add' });

tooltip.selectAll('.tooltip-inner')
.insert('svg', 'span')
.attr('class', 'tooltip-illustration')
.append('use')
.attr('xlink:href', '#poi-images');

context.on('enter.intro', placePoint);
}

Expand Down
6 changes: 4 additions & 2 deletions modules/ui/intro/start_editing.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ export function uiIntroStartEditing(context, reveal) {
});

startbutton
.append('div')
.attr('class','illustration');
.append('svg')
.attr('class', 'illustration')
.append('use')
.attr('xlink:href', '#logo-walkthrough');

startbutton
.append('h2')
Expand Down
Loading

0 comments on commit 02e5ae4

Please sign in to comment.