awesome_tooltip 0.1.4 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08ba51213ce458cd61b326160031394ca78184c2dea2482567a94a0a406423fd'
4
- data.tar.gz: 97472fd0c4aa834656859cbcad07f324620d3688ccc1e14fde0fc344769e7544
3
+ metadata.gz: ee17f8477a6ae94f8d6f7011f2133cbd58f0a33663f28bc3010792a6e826b735
4
+ data.tar.gz: f80d0cf419a9d75ff5cf8be288b957d1bf49d9a23f08bdca0e2d9b68a0cf583c
5
5
  SHA512:
6
- metadata.gz: 9c1ab0739c876e399e5d7afcef7dcbd6a777ac50a0491a2de56075ddf1a37453a3d5bb7c7f69b864cf74eaf932686924061c9ad67551b8477c87e78a6f1822b8
7
- data.tar.gz: 9f9029f4913dd27b498427b80c9e508d19dcb73207e2b18ba7ea58417668e8bcf9d789004ebc833dff35512cfcb86e1082a905b5dab6984f959e055d4c48b854
6
+ metadata.gz: 71bba3c47aa1b1dcd60328d19014feb26d0372324b9ad142eaf5974d228da0e971be35fc44c011b3fdf95aef5103ef2c52ea65beb03b6507682ddf5c76f8085f
7
+ data.tar.gz: b873d5a38d29cb132daab27187b6a0e20023ba52ac65650342b433c98b678087c0d801db4e3f8cac61eb6307f08efef94d1de24f4608a2deb91b7efb31ab7ea8
@@ -39,11 +39,10 @@
39
39
  var tooltipTriangle = tooltip.querySelector(".content-wrapper .triangle");
40
40
  var elementRects = element.getClientRects()[0];
41
41
 
42
- var leftEnoughSpace = tooltip.offsetWidth / 2 < elementRects.left;
42
+ var leftEnoughSpace = tooltip.offsetWidth / 2 + element.offsetWidth / 2 < elementRects.left;
43
43
  var rightEnoughSpace = tooltip.offsetWidth / 2 < D.body.offsetWidth - elementRects.right;
44
- var bottomEnoughSpace = tooltip.offsetHeight < W.height - elementRects.bottom;
45
- var topEnoughSpace = tooltip.offsetHeight < elementRects.top;
46
-
44
+ var bottomEnoughSpace = tooltip.offsetHeight < W.outerHeight - elementRects.bottom;
45
+ var topEnoughSpace = tooltip.offsetHeight + tooltipTriangle.offsetHeight < elementRects.top;
47
46
 
48
47
  if(leftEnoughSpace && rightEnoughSpace && topEnoughSpace && bottomEnoughSpace) {
49
48
  tooltip.style.cssText = "left: " + ((elementRects.width / 2) - (tooltip.getClientRects()[0].width / 2)) + "px;";
@@ -72,7 +71,7 @@
72
71
 
73
72
  if(!leftEnoughSpace || !rightEnoughSpace) {
74
73
  if(W.innerWidth / 2 > elementRects.right) {
75
- tooltip.style.cssText = "left: " + (elementRects.right - element.offsetWidth) + "px;";
74
+ tooltip.style.cssText = "left: -" + (elementRects.right - element.offsetWidth) + "px;";
76
75
  tooltipTriangle.style.cssText = "left: " + (elementRects.right - element.offsetWidth + tooltipTriangle.offsetWidth + tooltipTriangle.offsetWidth / 2) + "px;";
77
76
  } else {
78
77
  tooltip.style.cssText = "right: -" + (D.body.offsetWidth - elementRects.right) + "px;";
@@ -85,7 +84,7 @@
85
84
  function display(element, tooltipTriangle, location) {
86
85
  var tooltip = element.querySelector(".awesome-tooltip");
87
86
 
88
- toggleLocation(element, location);
87
+ toggleLocation(tooltip, location);
89
88
  tooltip.style.cssText = "left: " + ((element.getClientRects()[0].width / 2) - (tooltip.getClientRects()[0].width / 2)) + "px;";
90
89
  tooltipTriangle.style.cssText = "left: calc(50% - " + (tooltipTriangle.offsetWidth / 2) + "px);";
91
90
  }
@@ -1,5 +1,6 @@
1
1
  .awesome-tooltip-wrapper {
2
2
  position: relative;
3
+ display: inline-block;
3
4
 
4
5
  .awesome-tooltip {
5
6
  position: absolute;
@@ -10,7 +11,7 @@
10
11
  }
11
12
 
12
13
  &.top {
13
- bottom: calc(100% + 15px);
14
+ bottom: calc(100% + 10px);
14
15
 
15
16
  .content-wrapper .triangle {
16
17
  border-left: 10px solid transparent;
@@ -21,7 +22,7 @@
21
22
  }
22
23
 
23
24
  &.bottom {
24
- top: calc(100% + 15px);
25
+ top: calc(100% + 10px);
25
26
 
26
27
  .content-wrapper .triangle {
27
28
  border-left: 10px solid transparent;
@@ -32,7 +33,7 @@
32
33
  }
33
34
 
34
35
  &.left {
35
- right: calc(100% + 15px);
36
+ right: calc(100% + 10px);
36
37
 
37
38
  .content-wrapper .triangle {
38
39
  border-bottom: 10px solid transparent;
@@ -43,7 +44,7 @@
43
44
  }
44
45
 
45
46
  &.right {
46
- left: calc(100% + 15px);
47
+ left: calc(100% + 10px);
47
48
 
48
49
  .content-wrapper .triangle {
49
50
  border-bottom: 10px solid transparent;
@@ -1,3 +1,3 @@
1
1
  module AwesomeTooltip
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_tooltip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Busko Bogdan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-19 00:00:00.000000000 Z
11
+ date: 2020-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails