Skip to content

Commit

Permalink
Removed aliases after review
Browse files Browse the repository at this point in the history
  • Loading branch information
zarov committed Apr 2, 2021
1 parent bbeb2f1 commit dc99ebf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
5 changes: 3 additions & 2 deletions src/ui/control/navigation_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ class NavigationControl {
`scale(${1 / Math.pow(Math.cos(this._map.transform.pitch * (Math.PI / 180)), 0.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle * (180 / Math.PI)}deg)` :
`rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;

const icon = this._compassIcon;
this._map._domRenderTaskQueue.add(() => {
icon.style.transform = rotate;
if (this._compassIcon) {
this._compassIcon.style.transform = rotate;
}
});
}

Expand Down
14 changes: 7 additions & 7 deletions src/ui/control/scale_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,24 @@ function updateScale(map, container, options) {
const maxFeet = 3.2808 * maxMeters;
if (maxFeet > 5280) {
const maxMiles = maxFeet / 5280;
setScale(map, container, maxWidth, maxMiles, map._getUIString('ScaleControl.Miles'));
setScale(container, maxWidth, maxMiles, map._getUIString('ScaleControl.Miles'), map._domRenderTaskQueue);
} else {
setScale(map, container, maxWidth, maxFeet, map._getUIString('ScaleControl.Feet'));
setScale(container, maxWidth, maxFeet, map._getUIString('ScaleControl.Feet'), map._domRenderTaskQueue);
}
} else if (options && options.unit === 'nautical') {
const maxNauticals = maxMeters / 1852;
setScale(map, container, maxWidth, maxNauticals, map._getUIString('ScaleControl.NauticalMiles'));
setScale(container, maxWidth, maxNauticals, map._getUIString('ScaleControl.NauticalMiles'), map._domRenderTaskQueue);
} else if (maxMeters >= 1000) {
setScale(map, container, maxWidth, maxMeters / 1000, map._getUIString('ScaleControl.Kilometers'));
setScale(container, maxWidth, maxMeters / 1000, map._getUIString('ScaleControl.Kilometers'), map._domRenderTaskQueue);
} else {
setScale(map, container, maxWidth, maxMeters, map._getUIString('ScaleControl.Meters'));
setScale(container, maxWidth, maxMeters, map._getUIString('ScaleControl.Meters'), map._domRenderTaskQueue);
}
}

function setScale(map, container, maxWidth, maxDistance, unit) {
function setScale(container, maxWidth, maxDistance, unit, mapQueue) {
const distance = getRoundNum(maxDistance);
const ratio = distance / maxDistance;
map._domRenderTaskQueue.add(() => {
mapQueue.add(() => {
container.style.width = `${maxWidth * ratio}px`;
container.innerHTML = `${distance} ${unit}`;
});
Expand Down
9 changes: 5 additions & 4 deletions src/ui/handler/box_zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,13 @@ class BoxZoomHandler {
minY = Math.min(p0.y, pos.y),
maxY = Math.max(p0.y, pos.y);

const box = this._box;
this._map._domRenderTaskQueue.add(() => {
DOM.setTransform(box, `translate(${minX}px,${minY}px)`);
if (this._box) {
DOM.setTransform(this._box, `translate(${minX}px,${minY}px)`);

box.style.width = `${maxX - minX}px`;
box.style.height = `${maxY - minY}px`;
this._box.style.width = `${maxX - minX}px`;
this._box.style.height = `${maxY - minY}px`;
}
});
}

Expand Down
8 changes: 4 additions & 4 deletions src/ui/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,11 @@ export default class Popup extends Evented {
}

const offsetedPos = pos.add(offset[anchor]).round();
const container = this._container;
const _anchor = anchor;
this._map._domRenderTaskQueue.add(() => {
DOM.setTransform(container, `${anchorTranslate[_anchor]} translate(${offsetedPos.x}px,${offsetedPos.y}px)`);
applyAnchorClass(container, _anchor, 'popup');
if (this._container && anchor) {
DOM.setTransform(this._container, `${anchorTranslate[anchor]} translate(${offsetedPos.x}px,${offsetedPos.y}px)`);
applyAnchorClass(this._container, anchor, 'popup');
}
});
}

Expand Down

0 comments on commit dc99ebf

Please sign in to comment.