Browse Source

chore: 整理

es6
guy 3 years ago
parent
commit
a5407abe8a
  1. 2
      src/base/combination/combo.js
  2. 18
      src/base/layer/layer.popup.js

2
src/base/combination/combo.js

@ -286,6 +286,8 @@
width: width, width: width,
height: height, height: height,
offsetStyle: o.offsetStyle, offsetStyle: o.offsetStyle,
adjustXOffset: o.adjustXOffset,
adjustYOffset: o.adjustYOffset,
offset: this.combo.element.offset() offset: this.combo.element.offset()
}); });
if ("left" in p) { if ("left" in p) {

18
src/base/layer/layer.popup.js

@ -176,6 +176,8 @@ BI.PopupView = BI.inherit(BI.Widget, {
setDirection: function (direction, position) { setDirection: function (direction, position) {
if (this.options.showArrow) { if (this.options.showArrow) {
var style, placeholderStyle; var style, placeholderStyle;
var adjustXOffset = position.adjustXOffset || 0;
var adjustYOffset = position.adjustYOffset || 0;
var bodyBounds = BI.Widget._renderEngine.createElement("body").bounds(); var bodyBounds = BI.Widget._renderEngine.createElement("body").bounds();
var bodyWidth = bodyBounds.width; var bodyWidth = bodyBounds.width;
var bodyHeight = bodyBounds.height; var bodyHeight = bodyBounds.height;
@ -200,7 +202,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
direction = "bottom"; direction = "bottom";
style = { style = {
// 5表示留出一定的空间 // 5表示留出一定的空间
left: BI.clamp((middle ? popupWidth : position.width) / 2 - 6, minLeft, maxLeft) left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 6, minLeft, maxLeft)
}; };
placeholderStyle = { placeholderStyle = {
left: 0, left: 0,
@ -213,7 +215,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "bottom,left": case "bottom,left":
direction = "bottom"; direction = "bottom";
style = { style = {
right: BI.clamp((middle ? popupWidth : position.width) / 2 - 6, minRight, maxRight) right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 6, minRight, maxRight)
}; };
placeholderStyle = { placeholderStyle = {
left: 0, left: 0,
@ -227,7 +229,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "top,right": case "top,right":
direction = "top"; direction = "top";
style = { style = {
left: BI.clamp((middle ? popupWidth : position.width) / 2 - 6, minLeft, maxLeft) left: BI.clamp(((middle ? popupWidth : position.width) - adjustXOffset) / 2 - 6, minLeft, maxLeft)
}; };
placeholderStyle = { placeholderStyle = {
left: 0, left: 0,
@ -240,7 +242,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "top,left": case "top,left":
direction = "top"; direction = "top";
style = { style = {
right: BI.clamp((middle ? popupWidth : position.width) / 2 - 6, minRight, maxRight) right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 6, minRight, maxRight)
}; };
placeholderStyle = { placeholderStyle = {
left: 0, left: 0,
@ -254,7 +256,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "left,bottom": case "left,bottom":
direction = "left"; direction = "left";
style = { style = {
top: BI.clamp((middle ? popupHeight : position.height) / 2 - 6, minTop, maxTop) top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 6, minTop, maxTop)
}; };
placeholderStyle = { placeholderStyle = {
top: 0, top: 0,
@ -267,7 +269,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "left,top": case "left,top":
direction = "left"; direction = "left";
style = { style = {
bottom: BI.clamp((middle ? popupHeight : position.height) / 2 - 6, minBottom, maxBottom) bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 6, minBottom, maxBottom)
}; };
placeholderStyle = { placeholderStyle = {
top: 0, top: 0,
@ -281,7 +283,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "right,bottom": case "right,bottom":
direction = "right"; direction = "right";
style = { style = {
top: BI.clamp((middle ? popupHeight : position.height) / 2 - 6, minTop, maxTop) top: BI.clamp(((middle ? popupHeight : position.height) - adjustYOffset) / 2 - 6, minTop, maxTop)
}; };
placeholderStyle = { placeholderStyle = {
top: 0, top: 0,
@ -294,7 +296,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
case "right,top": case "right,top":
direction = "right"; direction = "right";
style = { style = {
bottom: BI.clamp((middle ? popupHeight : position.height) / 2 - 6, minBottom, maxBottom) bottom: BI.clamp(((middle ? popupHeight : position.height) + adjustYOffset) / 2 - 6, minBottom, maxBottom)
}; };
placeholderStyle = { placeholderStyle = {
top: 0, top: 0,

Loading…
Cancel
Save