mirror of
https://github.com/moparisthebest/mail
synced 2024-11-30 04:42:15 -05:00
fix popover size on init
This commit is contained in:
parent
c41eb1337f
commit
b4aa3a5493
@ -16,32 +16,32 @@ define(function(require) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
var ngModule = angular.module('popover', []);
|
var ngModule = angular.module('popover', []);
|
||||||
ngModule.directive('popover', function($parse) {
|
ngModule.directive('popover', function() {
|
||||||
return function(scope, elm, attrs) {
|
return function(scope, elm, attrs) {
|
||||||
var popover = angular.element(document.querySelector('.popover'));
|
var popover = angular.element(document.querySelector('.popover'));
|
||||||
|
|
||||||
|
var model = attrs.popover;
|
||||||
|
scope.$watch(model, function(value) {
|
||||||
|
// set popover title and content
|
||||||
|
scope.state.popover.title = attrs.popoverTitle;
|
||||||
|
scope.state.popover.content = value;
|
||||||
|
});
|
||||||
|
|
||||||
elm.on('mouseover', function() {
|
elm.on('mouseover', function() {
|
||||||
var model = $parse(attrs.popover);
|
// set popover position
|
||||||
scope.$watch(model, function(value) {
|
var top = elm[0].offsetTop;
|
||||||
// set popover title and content
|
var left = elm[0].offsetLeft;
|
||||||
scope.state.popover.title = attrs.popoverTitle;
|
var width = elm[0].offsetWidth;
|
||||||
scope.state.popover.content = value;
|
var height = elm[0].offsetHeight;
|
||||||
|
|
||||||
// set popover position
|
popover[0].style.transition = 'opacity 0.3s linear';
|
||||||
var top = elm[0].offsetTop;
|
popover[0].style.top = (top + height / 2 - popover[0].offsetHeight / 2) + 'px';
|
||||||
var left = elm[0].offsetLeft;
|
popover[0].style.left = (left + width) + 'px';
|
||||||
var width = elm[0].offsetWidth;
|
popover[0].style.opacity = '1';
|
||||||
var height = elm[0].offsetHeight;
|
|
||||||
|
|
||||||
popover[0].style.transition = 'opacity 0.4s linear';
|
|
||||||
popover[0].style.top = (top + height / 2 - popover[0].offsetHeight / 2) + 'px';
|
|
||||||
popover[0].style.left = (left + width) + 'px';
|
|
||||||
popover[0].style.opacity = '1';
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
elm.on('mouseout', function() {
|
elm.on('mouseout', function() {
|
||||||
popover[0].style.transition = 'opacity 0.4s linear, top 0.4s step-end, left 0.4s step-end';
|
popover[0].style.transition = 'opacity 0.3s linear, top 0.3s step-end, left 0.3s step-end';
|
||||||
popover[0].style.opacity = '0';
|
popover[0].style.opacity = '0';
|
||||||
popover[0].style.top = '-9999px';
|
popover[0].style.top = '-9999px';
|
||||||
popover[0].style.left = '-9999px';
|
popover[0].style.left = '-9999px';
|
||||||
|
@ -13,6 +13,9 @@ define(function(require) {
|
|||||||
crypto = appController._crypto;
|
crypto = appController._crypto;
|
||||||
keychain = appController._keychain;
|
keychain = appController._keychain;
|
||||||
|
|
||||||
|
// set default value so that the popover height is correct on init
|
||||||
|
$scope.fingerprint = 'XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX';
|
||||||
|
|
||||||
$scope.state.read = {
|
$scope.state.read = {
|
||||||
open: false,
|
open: false,
|
||||||
toggle: function(to) {
|
toggle: function(to) {
|
||||||
|
Loading…
Reference in New Issue
Block a user