Fixed a minor bug within the popper and cleaned up some of the code.
This commit is contained in:
		
							
								
								
									
										17
									
								
								popper.js
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								popper.js
									
									
									
									
									
								
							@@ -30,14 +30,14 @@ class Popper extends IgniteElement {
 | 
				
			|||||||
        return this.template.child(
 | 
					        return this.template.child(
 | 
				
			||||||
            new slot(this)
 | 
					            new slot(this)
 | 
				
			||||||
                .style("position", "absolute")
 | 
					                .style("position", "absolute")
 | 
				
			||||||
                .style("top", this.position, true, value => { return value == "bottom" ? "100%" : null; })
 | 
					                .style("top", this.position, true, value => value == "bottom" ? "100%" : null)
 | 
				
			||||||
                .style("bottom", this.position, true, value => { return value == "top" ? "100%" : null; })
 | 
					                .style("bottom", this.position, true, value => value == "top" ? "100%" : null)
 | 
				
			||||||
                .style("margin-top", this.position, true, value => { return this.position == "bottom" ? this.offset : null })
 | 
					                .style("margin-top", this.position, true, value => this.position == "bottom" ? this.offset : null)
 | 
				
			||||||
                .style("margin-bottom", this.position, true, value => { return this.position == "top" ? this.offset : null })
 | 
					                .style("margin-bottom", this.position, true, value => this.position == "top" ? this.offset : null)
 | 
				
			||||||
                .style("left", "0")
 | 
					                .style("left", "0")
 | 
				
			||||||
                .style("width", "100%")
 | 
					                .style("width", "100%")
 | 
				
			||||||
                .style("z-index", "99999")
 | 
					                .style("z-index", "99999")
 | 
				
			||||||
                .hide(this.show, value => { return !value; })
 | 
					                .hide(this.show, value => !value)
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -54,8 +54,7 @@ class Popper extends IgniteElement {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //Only perform the calculation if we are ready.
 | 
					        //Only perform the calculation if we are ready.
 | 
				
			||||||
        if (this.offsetParent && this.firstChild)
 | 
					        if (this.offsetParent && this.firstChild) {
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            var bounds = this.firstChild.getBoundingClientRect();
 | 
					            var bounds = this.firstChild.getBoundingClientRect();
 | 
				
			||||||
            var parentBounds = this.offsetParent.getBoundingClientRect();
 | 
					            var parentBounds = this.offsetParent.getBoundingClientRect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -66,9 +65,9 @@ class Popper extends IgniteElement {
 | 
				
			|||||||
                offset = this.firstChild.offsetTop - parentBounds.height;
 | 
					                offset = this.firstChild.offsetTop - parentBounds.height;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (bounds.y < 0 && this.position != "bottom" && (bounds.y + (bounds.height * 2) + offset + parentBounds.height) < window.innerHeight) {
 | 
					            if (bounds.y < 0 && this.position != "bottom" && (bounds.y + (bounds.height * 2) + (offset * 2) + parentBounds.height) < window.innerHeight) {
 | 
				
			||||||
                this.position = "bottom";
 | 
					                this.position = "bottom";
 | 
				
			||||||
            } else if (bounds.y + bounds.height + offset >= window.innerHeight && this.position != "top") {
 | 
					            } else if (bounds.y + bounds.height >= window.innerHeight && this.position != "top") {
 | 
				
			||||||
                this.position = "top";
 | 
					                this.position = "top";
 | 
				
			||||||
            } else if (parentBounds.height + parentBounds.y + bounds.height + offset <= window.innerHeight && this.position != "bottom") {
 | 
					            } else if (parentBounds.height + parentBounds.y + bounds.height + offset <= window.innerHeight && this.position != "bottom") {
 | 
				
			||||||
                this.position = "bottom";
 | 
					                this.position = "bottom";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user