awesome_tooltip 0.1.4 → 0.1.5

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: 797a148e34dd9a929accdd686f18729013fb36c3790f9c9dcc0c8f5981c2ab31
4
+ data.tar.gz: d8616edfc05031cbc4637b6e8ab0f49b541d6b8eee1c4695feffc4910d4b7f2a
5
5
  SHA512:
6
- metadata.gz: 9c1ab0739c876e399e5d7afcef7dcbd6a777ac50a0491a2de56075ddf1a37453a3d5bb7c7f69b864cf74eaf932686924061c9ad67551b8477c87e78a6f1822b8
7
- data.tar.gz: 9f9029f4913dd27b498427b80c9e508d19dcb73207e2b18ba7ea58417668e8bcf9d789004ebc833dff35512cfcb86e1082a905b5dab6984f959e055d4c48b854
6
+ metadata.gz: e4a25abd8a098d0c5112905b2ce9ff8f2bd8e5df7f5fc4a33e75304f65285ba813693510b016487e23da3b01c629b4e0bbf359f44ee3d2ea2efbd14a8bfd109b
7
+ data.tar.gz: ac15097e20390af82148bc360b79a84d9c9c83130fe79b85e8d6f49b058c4443e5d33873f6b4e41ea1721e39f07658d2c5a751abac32a97e24ec6de24b8f0787
@@ -39,12 +39,11 @@
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;
44
+ var bottomEnoughSpace = tooltip.offsetHeight < W.outerHeight - elementRects.bottom;
45
45
  var topEnoughSpace = tooltip.offsetHeight < elementRects.top;
46
46
 
47
-
48
47
  if(leftEnoughSpace && rightEnoughSpace && topEnoughSpace && bottomEnoughSpace) {
49
48
  tooltip.style.cssText = "left: " + ((elementRects.width / 2) - (tooltip.getClientRects()[0].width / 2)) + "px;";
50
49
  tooltipTriangle.style.cssText = "left: calc(50% - " + (tooltipTriangle.offsetWidth / 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;
3
4
 
4
5
  .awesome-tooltip {
5
6
  position: absolute;
@@ -1,3 +1,3 @@
1
1
  module AwesomeTooltip
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Busko Bogdan