Canvas add delay to overlay

This commit is contained in:
per ploug
2014-10-06 11:55:34 +02:00
parent 0ce83630d7
commit 7ae9a2bda6
3 changed files with 34 additions and 8 deletions

View File

@@ -0,0 +1,26 @@
angular.module("umbraco.directives")
.directive('delayedMouseleave', function ($timeout, $parse) {
return {
restrict: 'A',
link: function (scope, element, attrs, ctrl) {
var active = false;
var fn = $parse(attrs.delayedMouseleave);
element.on("mouseleave", function(event) {
var callback = function() {
fn(scope, {$event:event});
};
active = false;
$timeout(function(){
if(active === false){
scope.$apply(callback);
}
}, 650);
});
element.on("mouseenter", function(event, args){
active = true;
});
}
};
});

View File

@@ -184,7 +184,7 @@
<!-- add stuff -->
<div class="cell-tools-add"
ng-if="!currentToolsControl && control===currentControl && (area.max === undefined || area.max < area.controls.length)"
ng-show="!currentToolsControl && control===currentControl && (area.max === undefined || area.max < area.controls.length)"
ng-animate="'fade'">
<div class="iconBox">
@@ -193,7 +193,7 @@
</a>
</div>
<div ng-if="overlayMenu.show && overlayMenu.key == control.$uniqueId" ng-include="'views/propertyeditors/canvas/dialogs/additem.html'"></div>
<div ng-show="overlayMenu.show && overlayMenu.key == control.$uniqueId" ng-include="'views/propertyeditors/canvas/dialogs/additem.html'"></div>
</div>
</div>

View File

@@ -1,17 +1,17 @@
<div class="cell-tools-menu"
<div class="cell-tools-menu"
ng-style="overlayMenu.style"
ng-mouseleave="closeItemOverlay()">
delayed-mouseleave="closeItemOverlay()">
<h5>Insert control</h5>
<ul class="elements">
<li ng-repeat="editor in area.$allowedEditors">
<a ng-click="addControl(editor, overlayMenu.area, overlayMenu.$index)" href>
<i class="icon {{editor.icon}}"></i>
<i class="icon {{editor.icon}}"></i>
{{editor.name}}</a>
<pre>{{editor}}</pre>
</li>
</ul>
</ul>
</div>
</div>