mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 13:18:15 +02:00
-2823
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 237 KiB |
@@ -10,12 +10,7 @@ import _union from 'lodash-es/union';
|
||||
|
||||
import { range as d3_range } from 'd3-array';
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import {
|
||||
request as d3_request,
|
||||
json as d3_json
|
||||
} from 'd3-request';
|
||||
|
||||
import { request as d3_request } from 'd3-request';
|
||||
import {
|
||||
select as d3_select,
|
||||
selectAll as d3_selectAll
|
||||
@@ -41,8 +36,6 @@ var _mlyFallback = false;
|
||||
var _mlyCache;
|
||||
var _mlyClicks;
|
||||
var _mlySelectedImage;
|
||||
// var _mlySignDefs;
|
||||
var _mlySignSprite;
|
||||
var _mlyViewer;
|
||||
|
||||
|
||||
@@ -386,30 +379,10 @@ export default {
|
||||
|
||||
|
||||
signsSupported: function() {
|
||||
// var detected = utilDetect();
|
||||
// if (detected.ie) return false;
|
||||
// if ((detected.browser.toLowerCase() === 'safari') && (parseFloat(detected.version) < 10)) return false;
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
// signHTML: function(d) {
|
||||
// if (!_mlySignDefs || !_mlySignSprite) return;
|
||||
// var position = _mlySignDefs[d.value];
|
||||
// if (!position) return '<div></div>';
|
||||
// var iconStyle = [
|
||||
// 'background-image:url(' + _mlySignSprite + ')',
|
||||
// 'background-repeat:no-repeat',
|
||||
// 'height:' + position.height + 'px',
|
||||
// 'width:' + position.width + 'px',
|
||||
// 'background-position-x:-' + position.x + 'px',
|
||||
// 'background-position-y:-' + position.y + 'px',
|
||||
// ];
|
||||
|
||||
// return '<div style="' + iconStyle.join(';') +'"></div>';
|
||||
// },
|
||||
|
||||
|
||||
loadImages: function(projection) {
|
||||
loadTiles('images', apibase + 'images?', projection);
|
||||
loadTiles('sequences', apibase + 'sequences?', projection);
|
||||
@@ -420,17 +393,6 @@ export default {
|
||||
// if we are looking at signs, we'll actually need to fetch images too
|
||||
loadTiles('images', apibase + 'images?', projection);
|
||||
loadTiles('objects', apibase + 'objects?', projection);
|
||||
|
||||
// load traffic sign defs
|
||||
|
||||
// if (!_mlySignDefs) {
|
||||
// _mlySignSprite = context.asset('img/traffic-signs/traffic-signs.png');
|
||||
// _mlySignDefs = {};
|
||||
// d3_json(context.asset('img/traffic-signs/traffic-signs.json'), function(err, data) {
|
||||
// if (err) return;
|
||||
// _mlySignDefs = data;
|
||||
// });
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
@@ -823,11 +785,4 @@ export default {
|
||||
return _mlyCache;
|
||||
}
|
||||
|
||||
|
||||
// signDefs: function(_) {
|
||||
// if (!arguments.length) return _mlySignDefs;
|
||||
// _mlySignDefs = _;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
};
|
||||
|
||||
@@ -112,23 +112,6 @@ export function svgMapillarySigns(projection, context, dispatch) {
|
||||
})
|
||||
.on('click', click);
|
||||
|
||||
// var enter = signs.enter()
|
||||
// .append('foreignObject')
|
||||
// .attr('class', 'icon-sign')
|
||||
// .attr('width', '24px') // for Firefox
|
||||
// .attr('height', '24px') // for Firefox
|
||||
// .classed('selected', function(d) {
|
||||
// return _some(d.detections, function(detection) {
|
||||
// return detection.image_key === selectedImageKey;
|
||||
// });
|
||||
// })
|
||||
// .on('click', click);
|
||||
|
||||
// enter
|
||||
// .append('xhtml:body')
|
||||
// .attr('class', 'icon-sign-body')
|
||||
// .html(service.signHTML);
|
||||
|
||||
// update
|
||||
signs
|
||||
.merge(enter)
|
||||
@@ -138,8 +121,6 @@ export function svgMapillarySigns(projection, context, dispatch) {
|
||||
: b.loc[1] - a.loc[1]; // sort Y
|
||||
})
|
||||
.attr('transform', transform);
|
||||
// .attr('x', function(d) { return projection(d.loc)[0] - 12; }) // offset by -12px to
|
||||
// .attr('y', function(d) { return projection(d.loc)[1] - 12; }); // center signs on loc
|
||||
}
|
||||
|
||||
|
||||
@@ -185,8 +166,7 @@ export function svgMapillarySigns(projection, context, dispatch) {
|
||||
|
||||
|
||||
drawSigns.supported = function() {
|
||||
var service = getService();
|
||||
return (service && service.signsSupported());
|
||||
return !!getService();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -156,31 +156,6 @@ describe('iD.serviceMapillary', function() {
|
||||
});
|
||||
|
||||
describe('#loadSigns', function() {
|
||||
// it('loads sign_defs', function() {
|
||||
// mapillary.loadSigns(context, context.projection);
|
||||
|
||||
// var sign = 'regulatory--maximum-speed-limit-65--g1',
|
||||
// match = /img\/traffic-signs\/traffic-signs.json/;
|
||||
|
||||
// server.respondWith('GET', match, function (xhr) {
|
||||
// xhr.respond(200, { 'Content-Type': 'application/json' },
|
||||
// '{ "' + sign + '": { "height": 24, "pixelRatio": 1, "width": 24, "x": 576, "y": 528} }');
|
||||
// });
|
||||
// server.respond();
|
||||
|
||||
// var sign_defs = mapillary.signDefs();
|
||||
|
||||
// expect(sign_defs).to.have.property('regulatory--maximum-speed-limit-65--g1')
|
||||
// .that.is.an('object')
|
||||
// .that.deep.equals({
|
||||
// height: 24,
|
||||
// pixelRatio: 1,
|
||||
// width: 24,
|
||||
// x: 576,
|
||||
// y: 528
|
||||
// });
|
||||
// });
|
||||
|
||||
it('fires loadedSigns when signs are loaded', function() {
|
||||
var spy = sinon.spy();
|
||||
mapillary.on('loadedSigns', spy);
|
||||
@@ -386,50 +361,6 @@ describe('iD.serviceMapillary', function() {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// describe('#signsSupported', function() {
|
||||
// it('returns false for Internet Explorer', function() {
|
||||
// ua = 'Trident/7.0; rv:11.0';
|
||||
// iD.Detect(true); // force redetection
|
||||
// expect(mapillary.signsSupported()).to.be.false;
|
||||
// });
|
||||
|
||||
// it('returns false for Safari 9', function() {
|
||||
// ua = 'Version/9.1 Safari/601';
|
||||
// iD.Detect(true); // force redetection
|
||||
// expect(mapillary.signsSupported()).to.be.false;
|
||||
// });
|
||||
|
||||
// it('returns true for Safari 10', function() {
|
||||
// ua = 'Version/10.0 Safari/602';
|
||||
// iD.Detect(true); // force redetection
|
||||
// expect(mapillary.signsSupported()).to.be.true;
|
||||
// });
|
||||
// });
|
||||
|
||||
// describe('#signHTML', function() {
|
||||
// it('returns sign HTML', function() {
|
||||
// mapillary.signDefs({
|
||||
// 'regulatory--maximum-speed-limit-65--g1': {
|
||||
// 'height': 24,
|
||||
// 'pixelRatio': 1,
|
||||
// 'width': 24,
|
||||
// 'x': 576,
|
||||
// 'y': 528,
|
||||
// },
|
||||
// });
|
||||
|
||||
// var signdata = {
|
||||
// key: '0',
|
||||
// loc: [10,0],
|
||||
// value: 'regulatory--maximum-speed-limit-65--g1',
|
||||
// };
|
||||
|
||||
// var sprite = context.asset('img/traffic-signs/traffic-signs.png');
|
||||
// expect(mapillary.signHTML(signdata)).to.eql('<div style="background-image:url(' + sprite + ');background-repeat:no-repeat;height:24px;width:24px;background-position-x:-576px;background-position-y:-528px"></div>');
|
||||
// });
|
||||
// });
|
||||
|
||||
describe('#selectImage', function() {
|
||||
it('gets and sets the selected image', function() {
|
||||
var d = { key: 'baz', loc: [10,0] };
|
||||
|
||||
Reference in New Issue
Block a user