Skip to content

Commit

Permalink
v0.10.0 📦
Browse files Browse the repository at this point in the history
  • Loading branch information
Wildhoney committed Apr 3, 2019
1 parent 77c7eb2 commit 91e5af7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 31 deletions.
61 changes: 32 additions & 29 deletions dist/ng-contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

if ('preventDefault' in event) {

contextMenu.cancelAll();
if(!attributes.persistentMenu) { contextMenu.cancelAll(); }
event.stopPropagation();
event.preventDefault();
scope.position = { x: event.clientX, y: event.clientY };
Expand All @@ -140,36 +140,39 @@

}

$templateRequest($sce.getTrustedResourceUrl(attributes.contextMenu)).then(function then(template) {
var opened = scope.menu;
if (attributes.persistentMenu) { contextMenu.cancelAll(); }

if (!attributes.persistentMenu || !opened) {
$templateRequest($sce.getTrustedResourceUrl(attributes.contextMenu)).then(function then(template) {

var compiled = $compile(template)($angular.extend(getModel())),
menu = $angular.element(compiled);

// Determine whether to append new, or replace an existing.
switch (strategy) {
case ('append'):
angular.element($document.body).append(menu);
break;
default:
scope.menu.replaceWith(menu);
break;
}

menu.css({
position: attributes.contextMenuPosition || 'fixed',
top: 0,
left: 0,
transform: $interpolate('translate({{x}}px, {{y}}px)')({
x: scope.position.x,
y: scope.position.y
})
});
scope.menu = menu;
if (!attributes.persistentMenu) { scope.menu.bind('click', closeMenu); }

var compiled = $compile(template)($angular.extend(getModel())),
menu = $angular.element(compiled);

// Determine whether to append new, or replace an existing.
switch (strategy) {
case ('append'):
angular.element($document.body).append(menu);
break;
default:
scope.menu.replaceWith(menu);
break;
}

menu.css({
position: attributes.contextMenuPosition || 'fixed',
top: 0,
left: 0,
transform: $interpolate('translate({{x}}px, {{y}}px)')({
x: scope.position.x,
y: scope.position.y
})
});

scope.menu = menu;
scope.menu.bind('click', closeMenu);

});

}
}

if (model) {
Expand Down
4 changes: 2 additions & 2 deletions dist/ng-contextmenu.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added releases/0.10.0.zip
Binary file not shown.

0 comments on commit 91e5af7

Please sign in to comment.