Browse Source

feature: 小三角换一种实现

es6
guy 3 years ago
parent
commit
d38c916f8b
  1. 33
      src/base/layer/layer.popup.js

33
src/base/layer/layer.popup.js

@ -181,10 +181,10 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "bottom,right": case "bottom,right":
direction = "bottom"; direction = "bottom";
style = { style = {
left: size.width / 2 - 6 // 5表示留出一定的空间
left: Math.min(size.width / 2 - 6, this.element.outerWidth() - 12 - 5)
}; };
placeholderStyle = { placeholderStyle = {
width: size.width,
left: 0, left: 0,
right: 0, right: 0,
height: this._const.TRIANGLE_LENGTH, height: this._const.TRIANGLE_LENGTH,
@ -195,11 +195,10 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "bottom,left": case "bottom,left":
direction = "bottom"; direction = "bottom";
style = { style = {
right: size.width / 2 - 6 right: Math.min(size.width / 2 - 6, this.element.outerWidth() - 12 - 5)
}; };
placeholderStyle = { placeholderStyle = {
width: size.width, left: 0,
left: "",
right: 0, right: 0,
height: this._const.TRIANGLE_LENGTH, height: this._const.TRIANGLE_LENGTH,
top: -this._const.TRIANGLE_LENGTH, top: -this._const.TRIANGLE_LENGTH,
@ -210,10 +209,9 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "top,right": case "top,right":
direction = "top"; direction = "top";
style = { style = {
left: size.width / 2 - 6 left: Math.min(size.width / 2 - 6, this.element.outerWidth() - 12 - 5)
}; };
placeholderStyle = { placeholderStyle = {
width: size.width,
left: 0, left: 0,
right: 0, right: 0,
height: this._const.TRIANGLE_LENGTH, height: this._const.TRIANGLE_LENGTH,
@ -224,11 +222,10 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "top,left": case "top,left":
direction = "top"; direction = "top";
style = { style = {
right: size.width / 2 - 6 right: Math.min(size.width / 2 - 6, this.element.outerWidth() - 12 - 5)
}; };
placeholderStyle = { placeholderStyle = {
width: size.width, left: 0,
left: "",
right: 0, right: 0,
height: this._const.TRIANGLE_LENGTH, height: this._const.TRIANGLE_LENGTH,
top: "", top: "",
@ -239,10 +236,9 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "left,bottom": case "left,bottom":
direction = "left"; direction = "left";
style = { style = {
top: size.height / 2 - 6 top: Math.min(size.height / 2 - 6, this.element.outerHeight() - 12 - 5)
}; };
placeholderStyle = { placeholderStyle = {
height: size.height,
top: 0, top: 0,
bottom: 0, bottom: 0,
width: this._const.TRIANGLE_LENGTH, width: this._const.TRIANGLE_LENGTH,
@ -253,11 +249,10 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "left,top": case "left,top":
direction = "left"; direction = "left";
style = { style = {
bottom: size.height / 2 - 6 bottom: Math.min(size.height / 2 - 6, this.element.outerHeight() - 12 - 5)
}; };
placeholderStyle = { placeholderStyle = {
height: size.height, top: 0,
top: "",
bottom: 0, bottom: 0,
width: this._const.TRIANGLE_LENGTH, width: this._const.TRIANGLE_LENGTH,
right: -this._const.TRIANGLE_LENGTH, right: -this._const.TRIANGLE_LENGTH,
@ -268,10 +263,9 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "right,bottom": case "right,bottom":
direction = "right"; direction = "right";
style = { style = {
top: size.height / 2 - 6 top: Math.min(size.height / 2 - 6, this.element.outerHeight() - 12 - 5)
}; };
placeholderStyle = { placeholderStyle = {
height: size.height,
top: 0, top: 0,
bottom: 0, bottom: 0,
width: this._const.TRIANGLE_LENGTH, width: this._const.TRIANGLE_LENGTH,
@ -282,11 +276,10 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "right,top": case "right,top":
direction = "right"; direction = "right";
style = { style = {
bottom: size.height / 2 - 6 bottom: Math.min(size.height / 2 - 6, this.element.outerHeight() - 12 - 5)
}; };
placeholderStyle = { placeholderStyle = {
height: size.height, top: 0,
top: "",
bottom: 0, bottom: 0,
width: this._const.TRIANGLE_LENGTH, width: this._const.TRIANGLE_LENGTH,
left: -this._const.TRIANGLE_LENGTH, left: -this._const.TRIANGLE_LENGTH,

Loading…
Cancel
Save