Skip to content

Commit

Permalink
Fix the selection rectangle on rotated maps.
Browse files Browse the repository at this point in the history
Use the Quad feature instead of the Plane feature.
  • Loading branch information
manthey committed Jun 3, 2016
1 parent 6946f8b commit d8e109a
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions src/mapInteractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var mapInteractor = function (args) {
m_queue,
$node,
m_selectionLayer = null,
m_selectionPlane = null,
m_selectionQuad,
m_paused = false,
m_clickMaybe = false,
m_callZoom = function () {};
Expand Down Expand Up @@ -566,22 +566,13 @@ var mapInteractor = function (args) {
gcs.upperRight = map.displayToGcs(display.upperRight);
gcs.lowerLeft = map.displayToGcs(display.lowerLeft);

m_selectionPlane.origin([
display.lowerLeft.x,
display.lowerLeft.y,
0
]);
m_selectionPlane.upperLeft([
display.upperLeft.x,
display.upperLeft.y,
0
]);
m_selectionPlane.lowerRight([
display.lowerRight.x,
display.lowerRight.y,
0
]);
m_selectionPlane.draw();
m_selectionQuad.data([{
ul: gcs.upperLeft,
ur: gcs.upperRight,
ll: gcs.lowerLeft,
lr: gcs.lowerRight
}]);
m_selectionQuad.draw();

return {
display: display,
Expand Down Expand Up @@ -686,10 +677,10 @@ var mapInteractor = function (args) {
}
// Create a feature layer and plane feature to show the selection bounds
m_selectionLayer = m_this.map().createLayer('feature', {renderer: 'd3'});
m_selectionPlane = m_selectionLayer.createFeature('plane');
m_selectionPlane.style({
screenCoordinates: true,
fillOpacity: function () { return 0.25; }
m_selectionQuad = m_selectionLayer.createFeature('quad');
m_selectionQuad.style({
opacity: 0.25,
color: {r: 0.3, g: 0.3, b: 0.3}
});
m_this.map().geoTrigger(geo_event.brushstart, m_this._getSelection());
}
Expand Down Expand Up @@ -918,7 +909,7 @@ var mapInteractor = function (args) {
m_selectionLayer.clear();
m_this.map().deleteLayer(m_selectionLayer);
m_selectionLayer = null;
m_selectionPlane = null;
m_selectionQuad = null;

m_this.map().geoTrigger(geo_event.brushend, selectionObj);
}
Expand Down

0 comments on commit d8e109a

Please sign in to comment.