mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-08 11:14:49 +02:00
697cef1b06
(closes #2386)
39 lines
957 B
JavaScript
39 lines
957 B
JavaScript
export function pointBox(loc, context) {
|
|
var rect = context.surfaceRect();
|
|
var point = context.curtainProjection(loc);
|
|
return {
|
|
left: point[0] + rect.left - 30,
|
|
top: point[1] + rect.top - 50,
|
|
width: 60,
|
|
height: 70
|
|
};
|
|
}
|
|
|
|
|
|
export function pad(locOrBox, padding, context) {
|
|
var box;
|
|
if (locOrBox instanceof Array) {
|
|
var rect = context.surfaceRect();
|
|
var point = context.curtainProjection(locOrBox);
|
|
box = {
|
|
left: point[0] + rect.left,
|
|
top: point[1] + rect.top
|
|
};
|
|
} else {
|
|
box = locOrBox;
|
|
}
|
|
|
|
return {
|
|
left: box.left - padding,
|
|
top: box.top - padding,
|
|
width: (box.width || 0) + 2 * padding,
|
|
height: (box.width || 0) + 2 * padding
|
|
};
|
|
}
|
|
|
|
|
|
export function icon(name, svgklass) {
|
|
return '<svg class="icon ' + (svgklass || '') + '">' +
|
|
'<use xlink:href="' + name + '"></use></svg>';
|
|
}
|