Skip to content

Commit

Permalink
Merge branch 'Erik' of https://github.com/TNOCS/csWeb into Erik
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvullings committed Oct 14, 2015
2 parents cbd2df8 + e3bb1ed commit 6cdeeb5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion csComp/services/layer/LayerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ module csComp.Services {
}

public getActions(feature: IFeature, type: ActionType): IActionOption[] {
if (!feature || !type) return;
if (!feature || typeof type !== 'number') return;
var options = [];
if (type === ActionType.Context) {
this.actionServices.forEach((as: csComp.Services.IActionService) => {
Expand Down
24 changes: 20 additions & 4 deletions csComp/services/map/renderers/leafletRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,16 @@ module csComp.Services {
var menu: any = $("#map-contextmenu");
button.dropdown('toggle');
var mapSize = this.map.getSize();
menu.css("left", e.originalEvent.x + 5);
menu.css("top", e.originalEvent.y - 35);
if (e.originalEvent.x < (mapSize.x / 2)) {//left half of screen
menu.css("left", e.originalEvent.x + 5);
} else {
menu.css("left", e.originalEvent.x - 5 - menu.width());
}
if (e.originalEvent.y < (mapSize.y / 2)) {//top half of screen
menu.css("top", e.originalEvent.y - 35);
} else {
menu.css("top", e.originalEvent.y - 70 - menu.height());
}
if (this.service.$rootScope.$$phase != '$apply' && this.service.$rootScope.$$phase != '$digest') { this.service.$rootScope.$apply(); }
});

Expand Down Expand Up @@ -358,8 +366,16 @@ module csComp.Services {
var menu: any = $("#map-contextmenu");
button.dropdown('toggle');
var mapSize = this.map.getSize();
menu.css("left", e.originalEvent.x + 5);
menu.css("top", e.originalEvent.y - 35);
if (e.originalEvent.x < (mapSize.x / 2)) {//left half of screen
menu.css("left", e.originalEvent.x + 5);
} else {
menu.css("left", e.originalEvent.x - 5 - menu.width());
}
if (e.originalEvent.y < (mapSize.y / 2)) {//top half of screen
menu.css("top", e.originalEvent.y - 35);
} else {
menu.css("top", e.originalEvent.y - 70 - menu.height());
}
if (this.service.$rootScope.$$phase != '$apply' && this.service.$rootScope.$$phase != '$digest') { this.service.$rootScope.$apply(); }
});

Expand Down

0 comments on commit 6cdeeb5

Please sign in to comment.