@opensumi/ide-components 2.21.3 → 2.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.js +134 -301
- package/lib/notification/notification.less +33 -11
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4433,58 +4433,34 @@ var react_dom_default = /*#__PURE__*/__webpack_require__.n(react_dom);
|
|
|
4433
4433
|
// CONCATENATED MODULE: /home/runner/work/core/core/node_modules/dom-align/dist-web/index.js
|
|
4434
4434
|
function ownKeys(object, enumerableOnly) {
|
|
4435
4435
|
var keys = Object.keys(object);
|
|
4436
|
-
|
|
4437
4436
|
if (Object.getOwnPropertySymbols) {
|
|
4438
4437
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
4443
|
-
});
|
|
4444
|
-
}
|
|
4445
|
-
|
|
4446
|
-
keys.push.apply(keys, symbols);
|
|
4438
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
4439
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
4440
|
+
})), keys.push.apply(keys, symbols);
|
|
4447
4441
|
}
|
|
4448
|
-
|
|
4449
4442
|
return keys;
|
|
4450
4443
|
}
|
|
4451
|
-
|
|
4452
4444
|
function _objectSpread2(target) {
|
|
4453
4445
|
for (var i = 1; i < arguments.length; i++) {
|
|
4454
|
-
var source = arguments[i]
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
4461
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
4462
|
-
} else {
|
|
4463
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
4464
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4465
|
-
});
|
|
4466
|
-
}
|
|
4446
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
4447
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
4448
|
+
_defineProperty(target, key, source[key]);
|
|
4449
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
4450
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4451
|
+
});
|
|
4467
4452
|
}
|
|
4468
|
-
|
|
4469
4453
|
return target;
|
|
4470
4454
|
}
|
|
4471
|
-
|
|
4472
4455
|
function _typeof(obj) {
|
|
4473
4456
|
"@babel/helpers - typeof";
|
|
4474
4457
|
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
}
|
|
4480
|
-
_typeof = function (obj) {
|
|
4481
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
4482
|
-
};
|
|
4483
|
-
}
|
|
4484
|
-
|
|
4485
|
-
return _typeof(obj);
|
|
4458
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
4459
|
+
return typeof obj;
|
|
4460
|
+
} : function (obj) {
|
|
4461
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
4462
|
+
}, _typeof(obj);
|
|
4486
4463
|
}
|
|
4487
|
-
|
|
4488
4464
|
function _defineProperty(obj, key, value) {
|
|
4489
4465
|
if (key in obj) {
|
|
4490
4466
|
Object.defineProperty(obj, key, {
|
|
@@ -4496,7 +4472,6 @@ function _defineProperty(obj, key, value) {
|
|
|
4496
4472
|
} else {
|
|
4497
4473
|
obj[key] = value;
|
|
4498
4474
|
}
|
|
4499
|
-
|
|
4500
4475
|
return obj;
|
|
4501
4476
|
}
|
|
4502
4477
|
|
|
@@ -4508,63 +4483,50 @@ var jsCssMap = {
|
|
|
4508
4483
|
ms: '-ms-',
|
|
4509
4484
|
O: '-o-'
|
|
4510
4485
|
};
|
|
4511
|
-
|
|
4512
4486
|
function getVendorPrefix() {
|
|
4513
4487
|
if (vendorPrefix !== undefined) {
|
|
4514
4488
|
return vendorPrefix;
|
|
4515
4489
|
}
|
|
4516
|
-
|
|
4517
4490
|
vendorPrefix = '';
|
|
4518
4491
|
var style = document.createElement('p').style;
|
|
4519
4492
|
var testProp = 'Transform';
|
|
4520
|
-
|
|
4521
4493
|
for (var key in jsCssMap) {
|
|
4522
4494
|
if (key + testProp in style) {
|
|
4523
4495
|
vendorPrefix = key;
|
|
4524
4496
|
}
|
|
4525
4497
|
}
|
|
4526
|
-
|
|
4527
4498
|
return vendorPrefix;
|
|
4528
4499
|
}
|
|
4529
|
-
|
|
4530
4500
|
function getTransitionName() {
|
|
4531
4501
|
return getVendorPrefix() ? "".concat(getVendorPrefix(), "TransitionProperty") : 'transitionProperty';
|
|
4532
4502
|
}
|
|
4533
|
-
|
|
4534
4503
|
function getTransformName() {
|
|
4535
4504
|
return getVendorPrefix() ? "".concat(getVendorPrefix(), "Transform") : 'transform';
|
|
4536
4505
|
}
|
|
4537
4506
|
function setTransitionProperty(node, value) {
|
|
4538
4507
|
var name = getTransitionName();
|
|
4539
|
-
|
|
4540
4508
|
if (name) {
|
|
4541
4509
|
node.style[name] = value;
|
|
4542
|
-
|
|
4543
4510
|
if (name !== 'transitionProperty') {
|
|
4544
4511
|
node.style.transitionProperty = value;
|
|
4545
4512
|
}
|
|
4546
4513
|
}
|
|
4547
4514
|
}
|
|
4548
|
-
|
|
4549
4515
|
function setTransform(node, value) {
|
|
4550
4516
|
var name = getTransformName();
|
|
4551
|
-
|
|
4552
4517
|
if (name) {
|
|
4553
4518
|
node.style[name] = value;
|
|
4554
|
-
|
|
4555
4519
|
if (name !== 'transform') {
|
|
4556
4520
|
node.style.transform = value;
|
|
4557
4521
|
}
|
|
4558
4522
|
}
|
|
4559
4523
|
}
|
|
4560
|
-
|
|
4561
4524
|
function getTransitionProperty(node) {
|
|
4562
4525
|
return node.style.transitionProperty || node.style[getTransitionName()];
|
|
4563
4526
|
}
|
|
4564
4527
|
function getTransformXY(node) {
|
|
4565
4528
|
var style = window.getComputedStyle(node, null);
|
|
4566
4529
|
var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
|
4567
|
-
|
|
4568
4530
|
if (transform && transform !== 'none') {
|
|
4569
4531
|
var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
|
|
4570
4532
|
return {
|
|
@@ -4572,7 +4534,6 @@ function getTransformXY(node) {
|
|
|
4572
4534
|
y: parseFloat(matrix[13] || matrix[5], 0)
|
|
4573
4535
|
};
|
|
4574
4536
|
}
|
|
4575
|
-
|
|
4576
4537
|
return {
|
|
4577
4538
|
x: 0,
|
|
4578
4539
|
y: 0
|
|
@@ -4583,11 +4544,9 @@ var matrix3d = /matrix3d\((.*)\)/;
|
|
|
4583
4544
|
function setTransformXY(node, xy) {
|
|
4584
4545
|
var style = window.getComputedStyle(node, null);
|
|
4585
4546
|
var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
|
4586
|
-
|
|
4587
4547
|
if (transform && transform !== 'none') {
|
|
4588
4548
|
var arr;
|
|
4589
4549
|
var match2d = transform.match(matrix2d);
|
|
4590
|
-
|
|
4591
4550
|
if (match2d) {
|
|
4592
4551
|
match2d = match2d[1];
|
|
4593
4552
|
arr = match2d.split(',').map(function (item) {
|
|
@@ -4611,64 +4570,63 @@ function setTransformXY(node, xy) {
|
|
|
4611
4570
|
}
|
|
4612
4571
|
|
|
4613
4572
|
var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
|
|
4614
|
-
var getComputedStyleX;
|
|
4573
|
+
var getComputedStyleX;
|
|
4615
4574
|
|
|
4575
|
+
// https://stackoverflow.com/a/3485654/3040605
|
|
4616
4576
|
function forceRelayout(elem) {
|
|
4617
4577
|
var originalStyle = elem.style.display;
|
|
4618
4578
|
elem.style.display = 'none';
|
|
4619
4579
|
elem.offsetHeight; // eslint-disable-line
|
|
4620
|
-
|
|
4621
4580
|
elem.style.display = originalStyle;
|
|
4622
4581
|
}
|
|
4623
|
-
|
|
4624
4582
|
function css(el, name, v) {
|
|
4625
4583
|
var value = v;
|
|
4626
|
-
|
|
4627
4584
|
if (_typeof(name) === 'object') {
|
|
4628
4585
|
for (var i in name) {
|
|
4629
4586
|
if (name.hasOwnProperty(i)) {
|
|
4630
4587
|
css(el, i, name[i]);
|
|
4631
4588
|
}
|
|
4632
4589
|
}
|
|
4633
|
-
|
|
4634
4590
|
return undefined;
|
|
4635
4591
|
}
|
|
4636
|
-
|
|
4637
4592
|
if (typeof value !== 'undefined') {
|
|
4638
4593
|
if (typeof value === 'number') {
|
|
4639
4594
|
value = "".concat(value, "px");
|
|
4640
4595
|
}
|
|
4641
|
-
|
|
4642
4596
|
el.style[name] = value;
|
|
4643
4597
|
return undefined;
|
|
4644
4598
|
}
|
|
4645
|
-
|
|
4646
4599
|
return getComputedStyleX(el, name);
|
|
4647
4600
|
}
|
|
4648
|
-
|
|
4649
4601
|
function getClientPosition(elem) {
|
|
4650
4602
|
var box;
|
|
4651
4603
|
var x;
|
|
4652
4604
|
var y;
|
|
4653
4605
|
var doc = elem.ownerDocument;
|
|
4654
4606
|
var body = doc.body;
|
|
4655
|
-
var docElem = doc && doc.documentElement;
|
|
4607
|
+
var docElem = doc && doc.documentElement;
|
|
4608
|
+
// 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
|
|
4609
|
+
box = elem.getBoundingClientRect();
|
|
4656
4610
|
|
|
4657
|
-
|
|
4611
|
+
// 注:jQuery 还考虑减去 docElem.clientLeft/clientTop
|
|
4658
4612
|
// 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确
|
|
4659
4613
|
// 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin
|
|
4660
4614
|
|
|
4661
4615
|
x = Math.floor(box.left);
|
|
4662
|
-
y = Math.floor(box.top);
|
|
4616
|
+
y = Math.floor(box.top);
|
|
4617
|
+
|
|
4618
|
+
// In IE, most of the time, 2 extra pixels are added to the top and left
|
|
4663
4619
|
// due to the implicit 2-pixel inset border. In IE6/7 quirks mode and
|
|
4664
4620
|
// IE6 standards mode, this border can be overridden by setting the
|
|
4665
4621
|
// document element's border to zero -- thus, we cannot rely on the
|
|
4666
4622
|
// offset always being 2 pixels.
|
|
4623
|
+
|
|
4667
4624
|
// In quirks mode, the offset can be determined by querying the body's
|
|
4668
4625
|
// clientLeft/clientTop, but in standards mode, it is found by querying
|
|
4669
4626
|
// the document element's clientLeft/clientTop. Since we already called
|
|
4670
4627
|
// getClientBoundingRect we have already forced a reflow, so it is not
|
|
4671
4628
|
// too expensive just to query them all.
|
|
4629
|
+
|
|
4672
4630
|
// ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
|
|
4673
4631
|
// 窗口边框标准是设 documentElement ,quirks 时设置 body
|
|
4674
4632
|
// 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
|
|
@@ -4684,33 +4642,26 @@ function getClientPosition(elem) {
|
|
|
4684
4642
|
top: y
|
|
4685
4643
|
};
|
|
4686
4644
|
}
|
|
4687
|
-
|
|
4688
4645
|
function getScroll(w, top) {
|
|
4689
4646
|
var ret = w["page".concat(top ? 'Y' : 'X', "Offset")];
|
|
4690
4647
|
var method = "scroll".concat(top ? 'Top' : 'Left');
|
|
4691
|
-
|
|
4692
4648
|
if (typeof ret !== 'number') {
|
|
4693
|
-
var d = w.document;
|
|
4694
|
-
|
|
4649
|
+
var d = w.document;
|
|
4650
|
+
// ie6,7,8 standard mode
|
|
4695
4651
|
ret = d.documentElement[method];
|
|
4696
|
-
|
|
4697
4652
|
if (typeof ret !== 'number') {
|
|
4698
4653
|
// quirks mode
|
|
4699
4654
|
ret = d.body[method];
|
|
4700
4655
|
}
|
|
4701
4656
|
}
|
|
4702
|
-
|
|
4703
4657
|
return ret;
|
|
4704
4658
|
}
|
|
4705
|
-
|
|
4706
4659
|
function getScrollLeft(w) {
|
|
4707
4660
|
return getScroll(w);
|
|
4708
4661
|
}
|
|
4709
|
-
|
|
4710
4662
|
function getScrollTop(w) {
|
|
4711
4663
|
return getScroll(w, true);
|
|
4712
4664
|
}
|
|
4713
|
-
|
|
4714
4665
|
function getOffset(el) {
|
|
4715
4666
|
var pos = getClientPosition(el);
|
|
4716
4667
|
var doc = el.ownerDocument;
|
|
@@ -4719,95 +4670,86 @@ function getOffset(el) {
|
|
|
4719
4670
|
pos.top += getScrollTop(w);
|
|
4720
4671
|
return pos;
|
|
4721
4672
|
}
|
|
4673
|
+
|
|
4722
4674
|
/**
|
|
4723
4675
|
* A crude way of determining if an object is a window
|
|
4724
4676
|
* @member util
|
|
4725
4677
|
*/
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
4678
|
function isWindow(obj) {
|
|
4729
4679
|
// must use == for ie8
|
|
4730
|
-
|
|
4731
4680
|
/* eslint eqeqeq:0 */
|
|
4732
4681
|
return obj !== null && obj !== undefined && obj == obj.window;
|
|
4733
4682
|
}
|
|
4734
|
-
|
|
4735
4683
|
function getDocument(node) {
|
|
4736
4684
|
if (isWindow(node)) {
|
|
4737
4685
|
return node.document;
|
|
4738
4686
|
}
|
|
4739
|
-
|
|
4740
4687
|
if (node.nodeType === 9) {
|
|
4741
4688
|
return node;
|
|
4742
4689
|
}
|
|
4743
|
-
|
|
4744
4690
|
return node.ownerDocument;
|
|
4745
4691
|
}
|
|
4746
|
-
|
|
4747
4692
|
function _getComputedStyle(elem, name, cs) {
|
|
4748
4693
|
var computedStyle = cs;
|
|
4749
4694
|
var val = '';
|
|
4750
4695
|
var d = getDocument(elem);
|
|
4751
|
-
computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
|
|
4696
|
+
computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
|
|
4752
4697
|
|
|
4698
|
+
// https://github.com/kissyteam/kissy/issues/61
|
|
4753
4699
|
if (computedStyle) {
|
|
4754
4700
|
val = computedStyle.getPropertyValue(name) || computedStyle[name];
|
|
4755
4701
|
}
|
|
4756
|
-
|
|
4757
4702
|
return val;
|
|
4758
4703
|
}
|
|
4759
|
-
|
|
4760
4704
|
var _RE_NUM_NO_PX = new RegExp("^(".concat(RE_NUM, ")(?!px)[a-z%]+$"), 'i');
|
|
4761
|
-
|
|
4762
4705
|
var RE_POS = /^(top|right|bottom|left)$/;
|
|
4763
4706
|
var CURRENT_STYLE = 'currentStyle';
|
|
4764
4707
|
var RUNTIME_STYLE = 'runtimeStyle';
|
|
4765
4708
|
var LEFT = 'left';
|
|
4766
4709
|
var PX = 'px';
|
|
4767
|
-
|
|
4768
4710
|
function _getComputedStyleIE(elem, name) {
|
|
4769
4711
|
// currentStyle maybe null
|
|
4770
4712
|
// http://msdn.microsoft.com/en-us/library/ms535231.aspx
|
|
4771
|
-
var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
|
4713
|
+
var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
|
4714
|
+
|
|
4715
|
+
// 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
|
|
4772
4716
|
// 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
|
|
4773
4717
|
// 在 ie 下不对,需要直接用 offset 方式
|
|
4774
4718
|
// borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了
|
|
4719
|
+
|
|
4775
4720
|
// From the awesome hack by Dean Edwards
|
|
4776
4721
|
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
|
4777
4722
|
// If we're not dealing with a regular pixel number
|
|
4778
4723
|
// but a number that has a weird ending, we need to convert it to pixels
|
|
4779
4724
|
// exclude left right for relativity
|
|
4780
|
-
|
|
4781
4725
|
if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
|
4782
4726
|
// Remember the original values
|
|
4783
4727
|
var style = elem.style;
|
|
4784
4728
|
var left = style[LEFT];
|
|
4785
|
-
var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
|
4729
|
+
var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
|
4786
4730
|
|
|
4787
|
-
|
|
4731
|
+
// prevent flashing of content
|
|
4732
|
+
elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
|
|
4788
4733
|
|
|
4734
|
+
// Put in the new values to get a computed value out
|
|
4789
4735
|
style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
|
|
4790
|
-
ret = style.pixelLeft + PX;
|
|
4736
|
+
ret = style.pixelLeft + PX;
|
|
4791
4737
|
|
|
4738
|
+
// Revert the changed values
|
|
4792
4739
|
style[LEFT] = left;
|
|
4793
4740
|
elem[RUNTIME_STYLE][LEFT] = rsLeft;
|
|
4794
4741
|
}
|
|
4795
|
-
|
|
4796
4742
|
return ret === '' ? 'auto' : ret;
|
|
4797
4743
|
}
|
|
4798
|
-
|
|
4799
4744
|
if (typeof window !== 'undefined') {
|
|
4800
4745
|
getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
|
|
4801
4746
|
}
|
|
4802
|
-
|
|
4803
4747
|
function getOffsetDirection(dir, option) {
|
|
4804
4748
|
if (dir === 'left') {
|
|
4805
4749
|
return option.useCssRight ? 'right' : dir;
|
|
4806
4750
|
}
|
|
4807
|
-
|
|
4808
4751
|
return option.useCssBottom ? 'bottom' : dir;
|
|
4809
4752
|
}
|
|
4810
|
-
|
|
4811
4753
|
function oppositeOffsetDirection(dir) {
|
|
4812
4754
|
if (dir === 'left') {
|
|
4813
4755
|
return 'right';
|
|
@@ -4818,59 +4760,49 @@ function oppositeOffsetDirection(dir) {
|
|
|
4818
4760
|
} else if (dir === 'bottom') {
|
|
4819
4761
|
return 'top';
|
|
4820
4762
|
}
|
|
4821
|
-
}
|
|
4822
|
-
|
|
4763
|
+
}
|
|
4823
4764
|
|
|
4765
|
+
// 设置 elem 相对 elem.ownerDocument 的坐标
|
|
4824
4766
|
function setLeftTop(elem, offset, option) {
|
|
4825
4767
|
// set position first, in-case top/left are set even on static elem
|
|
4826
4768
|
if (css(elem, 'position') === 'static') {
|
|
4827
4769
|
elem.style.position = 'relative';
|
|
4828
4770
|
}
|
|
4829
|
-
|
|
4830
4771
|
var presetH = -999;
|
|
4831
4772
|
var presetV = -999;
|
|
4832
4773
|
var horizontalProperty = getOffsetDirection('left', option);
|
|
4833
4774
|
var verticalProperty = getOffsetDirection('top', option);
|
|
4834
4775
|
var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
|
|
4835
4776
|
var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
|
|
4836
|
-
|
|
4837
4777
|
if (horizontalProperty !== 'left') {
|
|
4838
4778
|
presetH = 999;
|
|
4839
4779
|
}
|
|
4840
|
-
|
|
4841
4780
|
if (verticalProperty !== 'top') {
|
|
4842
4781
|
presetV = 999;
|
|
4843
4782
|
}
|
|
4844
|
-
|
|
4845
4783
|
var originalTransition = '';
|
|
4846
4784
|
var originalOffset = getOffset(elem);
|
|
4847
|
-
|
|
4848
4785
|
if ('left' in offset || 'top' in offset) {
|
|
4849
4786
|
originalTransition = getTransitionProperty(elem) || '';
|
|
4850
4787
|
setTransitionProperty(elem, 'none');
|
|
4851
4788
|
}
|
|
4852
|
-
|
|
4853
4789
|
if ('left' in offset) {
|
|
4854
4790
|
elem.style[oppositeHorizontalProperty] = '';
|
|
4855
4791
|
elem.style[horizontalProperty] = "".concat(presetH, "px");
|
|
4856
4792
|
}
|
|
4857
|
-
|
|
4858
4793
|
if ('top' in offset) {
|
|
4859
4794
|
elem.style[oppositeVerticalProperty] = '';
|
|
4860
4795
|
elem.style[verticalProperty] = "".concat(presetV, "px");
|
|
4861
|
-
}
|
|
4862
|
-
|
|
4863
|
-
|
|
4796
|
+
}
|
|
4797
|
+
// force relayout
|
|
4864
4798
|
forceRelayout(elem);
|
|
4865
4799
|
var old = getOffset(elem);
|
|
4866
4800
|
var originalStyle = {};
|
|
4867
|
-
|
|
4868
4801
|
for (var key in offset) {
|
|
4869
4802
|
if (offset.hasOwnProperty(key)) {
|
|
4870
4803
|
var dir = getOffsetDirection(key, option);
|
|
4871
4804
|
var preset = key === 'left' ? presetH : presetV;
|
|
4872
4805
|
var off = originalOffset[key] - old[key];
|
|
4873
|
-
|
|
4874
4806
|
if (dir === key) {
|
|
4875
4807
|
originalStyle[dir] = preset + off;
|
|
4876
4808
|
} else {
|
|
@@ -4878,23 +4810,17 @@ function setLeftTop(elem, offset, option) {
|
|
|
4878
4810
|
}
|
|
4879
4811
|
}
|
|
4880
4812
|
}
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4813
|
+
css(elem, originalStyle);
|
|
4814
|
+
// force relayout
|
|
4884
4815
|
forceRelayout(elem);
|
|
4885
|
-
|
|
4886
4816
|
if ('left' in offset || 'top' in offset) {
|
|
4887
4817
|
setTransitionProperty(elem, originalTransition);
|
|
4888
4818
|
}
|
|
4889
|
-
|
|
4890
4819
|
var ret = {};
|
|
4891
|
-
|
|
4892
4820
|
for (var _key in offset) {
|
|
4893
4821
|
if (offset.hasOwnProperty(_key)) {
|
|
4894
4822
|
var _dir = getOffsetDirection(_key, option);
|
|
4895
|
-
|
|
4896
4823
|
var _off = offset[_key] - originalOffset[_key];
|
|
4897
|
-
|
|
4898
4824
|
if (_key === _dir) {
|
|
4899
4825
|
ret[_dir] = originalStyle[_dir] + _off;
|
|
4900
4826
|
} else {
|
|
@@ -4902,10 +4828,8 @@ function setLeftTop(elem, offset, option) {
|
|
|
4902
4828
|
}
|
|
4903
4829
|
}
|
|
4904
4830
|
}
|
|
4905
|
-
|
|
4906
4831
|
css(elem, ret);
|
|
4907
4832
|
}
|
|
4908
|
-
|
|
4909
4833
|
function setTransform$1(elem, offset) {
|
|
4910
4834
|
var originalOffset = getOffset(elem);
|
|
4911
4835
|
var originalXY = getTransformXY(elem);
|
|
@@ -4913,18 +4837,14 @@ function setTransform$1(elem, offset) {
|
|
|
4913
4837
|
x: originalXY.x,
|
|
4914
4838
|
y: originalXY.y
|
|
4915
4839
|
};
|
|
4916
|
-
|
|
4917
4840
|
if ('left' in offset) {
|
|
4918
4841
|
resultXY.x = originalXY.x + offset.left - originalOffset.left;
|
|
4919
4842
|
}
|
|
4920
|
-
|
|
4921
4843
|
if ('top' in offset) {
|
|
4922
4844
|
resultXY.y = originalXY.y + offset.top - originalOffset.top;
|
|
4923
4845
|
}
|
|
4924
|
-
|
|
4925
4846
|
setTransformXY(elem, resultXY);
|
|
4926
4847
|
}
|
|
4927
|
-
|
|
4928
4848
|
function setOffset(elem, offset, option) {
|
|
4929
4849
|
if (option.ignoreShake) {
|
|
4930
4850
|
var oriOffset = getOffset(elem);
|
|
@@ -4932,12 +4852,10 @@ function setOffset(elem, offset, option) {
|
|
|
4932
4852
|
var oTop = oriOffset.top.toFixed(0);
|
|
4933
4853
|
var tLeft = offset.left.toFixed(0);
|
|
4934
4854
|
var tTop = offset.top.toFixed(0);
|
|
4935
|
-
|
|
4936
4855
|
if (oLeft === tLeft && oTop === tTop) {
|
|
4937
4856
|
return;
|
|
4938
4857
|
}
|
|
4939
4858
|
}
|
|
4940
|
-
|
|
4941
4859
|
if (option.useCssRight || option.useCssBottom) {
|
|
4942
4860
|
setLeftTop(elem, offset, option);
|
|
4943
4861
|
} else if (option.useCssTransform && getTransformName() in document.body.style) {
|
|
@@ -4946,75 +4864,64 @@ function setOffset(elem, offset, option) {
|
|
|
4946
4864
|
setLeftTop(elem, offset, option);
|
|
4947
4865
|
}
|
|
4948
4866
|
}
|
|
4949
|
-
|
|
4950
4867
|
function each(arr, fn) {
|
|
4951
4868
|
for (var i = 0; i < arr.length; i++) {
|
|
4952
4869
|
fn(arr[i]);
|
|
4953
4870
|
}
|
|
4954
4871
|
}
|
|
4955
|
-
|
|
4956
4872
|
function isBorderBoxFn(elem) {
|
|
4957
4873
|
return getComputedStyleX(elem, 'boxSizing') === 'border-box';
|
|
4958
4874
|
}
|
|
4959
|
-
|
|
4960
4875
|
var BOX_MODELS = ['margin', 'border', 'padding'];
|
|
4961
4876
|
var CONTENT_INDEX = -1;
|
|
4962
4877
|
var PADDING_INDEX = 2;
|
|
4963
4878
|
var BORDER_INDEX = 1;
|
|
4964
4879
|
var MARGIN_INDEX = 0;
|
|
4965
|
-
|
|
4966
4880
|
function swap(elem, options, callback) {
|
|
4967
4881
|
var old = {};
|
|
4968
4882
|
var style = elem.style;
|
|
4969
|
-
var name;
|
|
4883
|
+
var name;
|
|
4970
4884
|
|
|
4885
|
+
// Remember the old values, and insert the new ones
|
|
4971
4886
|
for (name in options) {
|
|
4972
4887
|
if (options.hasOwnProperty(name)) {
|
|
4973
4888
|
old[name] = style[name];
|
|
4974
4889
|
style[name] = options[name];
|
|
4975
4890
|
}
|
|
4976
4891
|
}
|
|
4892
|
+
callback.call(elem);
|
|
4977
4893
|
|
|
4978
|
-
|
|
4979
|
-
|
|
4894
|
+
// Revert the old values
|
|
4980
4895
|
for (name in options) {
|
|
4981
4896
|
if (options.hasOwnProperty(name)) {
|
|
4982
4897
|
style[name] = old[name];
|
|
4983
4898
|
}
|
|
4984
4899
|
}
|
|
4985
4900
|
}
|
|
4986
|
-
|
|
4987
4901
|
function getPBMWidth(elem, props, which) {
|
|
4988
4902
|
var value = 0;
|
|
4989
4903
|
var prop;
|
|
4990
4904
|
var j;
|
|
4991
4905
|
var i;
|
|
4992
|
-
|
|
4993
4906
|
for (j = 0; j < props.length; j++) {
|
|
4994
4907
|
prop = props[j];
|
|
4995
|
-
|
|
4996
4908
|
if (prop) {
|
|
4997
4909
|
for (i = 0; i < which.length; i++) {
|
|
4998
4910
|
var cssProp = void 0;
|
|
4999
|
-
|
|
5000
4911
|
if (prop === 'border') {
|
|
5001
4912
|
cssProp = "".concat(prop).concat(which[i], "Width");
|
|
5002
4913
|
} else {
|
|
5003
4914
|
cssProp = prop + which[i];
|
|
5004
4915
|
}
|
|
5005
|
-
|
|
5006
4916
|
value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
|
5007
4917
|
}
|
|
5008
4918
|
}
|
|
5009
4919
|
}
|
|
5010
|
-
|
|
5011
4920
|
return value;
|
|
5012
4921
|
}
|
|
5013
|
-
|
|
5014
4922
|
var domUtils = {
|
|
5015
4923
|
getParent: function getParent(element) {
|
|
5016
4924
|
var parent = element;
|
|
5017
|
-
|
|
5018
4925
|
do {
|
|
5019
4926
|
if (parent.nodeType === 11 && parent.host) {
|
|
5020
4927
|
parent = parent.host;
|
|
@@ -5022,31 +4929,32 @@ var domUtils = {
|
|
|
5022
4929
|
parent = parent.parentNode;
|
|
5023
4930
|
}
|
|
5024
4931
|
} while (parent && parent.nodeType !== 1 && parent.nodeType !== 9);
|
|
5025
|
-
|
|
5026
4932
|
return parent;
|
|
5027
4933
|
}
|
|
5028
4934
|
};
|
|
5029
4935
|
each(['Width', 'Height'], function (name) {
|
|
5030
4936
|
domUtils["doc".concat(name)] = function (refWin) {
|
|
5031
4937
|
var d = refWin.document;
|
|
5032
|
-
return Math.max(
|
|
4938
|
+
return Math.max(
|
|
4939
|
+
// firefox chrome documentElement.scrollHeight< body.scrollHeight
|
|
5033
4940
|
// ie standard mode : documentElement.scrollHeight> body.scrollHeight
|
|
5034
|
-
d.documentElement["scroll".concat(name)],
|
|
4941
|
+
d.documentElement["scroll".concat(name)],
|
|
4942
|
+
// quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
|
|
5035
4943
|
d.body["scroll".concat(name)], domUtils["viewport".concat(name)](d));
|
|
5036
4944
|
};
|
|
5037
|
-
|
|
5038
4945
|
domUtils["viewport".concat(name)] = function (win) {
|
|
5039
4946
|
// pc browser includes scrollbar in window.innerWidth
|
|
5040
4947
|
var prop = "client".concat(name);
|
|
5041
4948
|
var doc = win.document;
|
|
5042
4949
|
var body = doc.body;
|
|
5043
4950
|
var documentElement = doc.documentElement;
|
|
5044
|
-
var documentElementProp = documentElement[prop];
|
|
4951
|
+
var documentElementProp = documentElement[prop];
|
|
4952
|
+
// 标准模式取 documentElement
|
|
5045
4953
|
// backcompat 取 body
|
|
5046
|
-
|
|
5047
4954
|
return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
|
5048
4955
|
};
|
|
5049
4956
|
});
|
|
4957
|
+
|
|
5050
4958
|
/*
|
|
5051
4959
|
得到元素的大小信息
|
|
5052
4960
|
@param elem
|
|
@@ -5055,73 +4963,60 @@ each(['Width', 'Height'], function (name) {
|
|
|
5055
4963
|
'border' : (css width) + padding + border
|
|
5056
4964
|
'margin' : (css width) + padding + border + margin
|
|
5057
4965
|
*/
|
|
5058
|
-
|
|
5059
4966
|
function getWH(elem, name, ex) {
|
|
5060
4967
|
var extra = ex;
|
|
5061
|
-
|
|
5062
4968
|
if (isWindow(elem)) {
|
|
5063
4969
|
return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
|
5064
4970
|
} else if (elem.nodeType === 9) {
|
|
5065
4971
|
return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
|
5066
4972
|
}
|
|
5067
|
-
|
|
5068
4973
|
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
|
5069
4974
|
var borderBoxValue = name === 'width' ? Math.floor(elem.getBoundingClientRect().width) : Math.floor(elem.getBoundingClientRect().height);
|
|
5070
4975
|
var isBorderBox = isBorderBoxFn(elem);
|
|
5071
4976
|
var cssBoxValue = 0;
|
|
5072
|
-
|
|
5073
4977
|
if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
|
|
5074
|
-
borderBoxValue = undefined;
|
|
5075
|
-
|
|
4978
|
+
borderBoxValue = undefined;
|
|
4979
|
+
// Fall back to computed then un computed css if necessary
|
|
5076
4980
|
cssBoxValue = getComputedStyleX(elem, name);
|
|
5077
|
-
|
|
5078
4981
|
if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
|
|
5079
4982
|
cssBoxValue = elem.style[name] || 0;
|
|
5080
|
-
}
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
cssBoxValue = parseFloat(cssBoxValue) || 0;
|
|
4983
|
+
}
|
|
4984
|
+
// Normalize '', auto, and prepare for extra
|
|
4985
|
+
cssBoxValue = Math.floor(parseFloat(cssBoxValue)) || 0;
|
|
5084
4986
|
}
|
|
5085
|
-
|
|
5086
4987
|
if (extra === undefined) {
|
|
5087
4988
|
extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
|
5088
4989
|
}
|
|
5089
|
-
|
|
5090
4990
|
var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
|
5091
4991
|
var val = borderBoxValue || cssBoxValue;
|
|
5092
|
-
|
|
5093
4992
|
if (extra === CONTENT_INDEX) {
|
|
5094
4993
|
if (borderBoxValueOrIsBorderBox) {
|
|
5095
4994
|
return val - getPBMWidth(elem, ['border', 'padding'], which);
|
|
5096
4995
|
}
|
|
5097
|
-
|
|
5098
4996
|
return cssBoxValue;
|
|
5099
4997
|
} else if (borderBoxValueOrIsBorderBox) {
|
|
5100
4998
|
if (extra === BORDER_INDEX) {
|
|
5101
4999
|
return val;
|
|
5102
5000
|
}
|
|
5103
|
-
|
|
5104
5001
|
return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which) : getPBMWidth(elem, ['margin'], which));
|
|
5105
5002
|
}
|
|
5106
|
-
|
|
5107
5003
|
return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which);
|
|
5108
5004
|
}
|
|
5109
|
-
|
|
5110
5005
|
var cssShow = {
|
|
5111
5006
|
position: 'absolute',
|
|
5112
5007
|
visibility: 'hidden',
|
|
5113
5008
|
display: 'block'
|
|
5114
|
-
};
|
|
5009
|
+
};
|
|
5115
5010
|
|
|
5011
|
+
// fix #119 : https://github.com/kissyteam/kissy/issues/119
|
|
5116
5012
|
function getWHIgnoreDisplay() {
|
|
5117
5013
|
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
5118
5014
|
args[_key2] = arguments[_key2];
|
|
5119
5015
|
}
|
|
5120
|
-
|
|
5121
5016
|
var val;
|
|
5122
|
-
var elem = args[0];
|
|
5017
|
+
var elem = args[0];
|
|
5018
|
+
// in case elem is window
|
|
5123
5019
|
// elem.offsetWidth === undefined
|
|
5124
|
-
|
|
5125
5020
|
if (elem.offsetWidth !== 0) {
|
|
5126
5021
|
val = getWH.apply(undefined, args);
|
|
5127
5022
|
} else {
|
|
@@ -5129,56 +5024,42 @@ function getWHIgnoreDisplay() {
|
|
|
5129
5024
|
val = getWH.apply(undefined, args);
|
|
5130
5025
|
});
|
|
5131
5026
|
}
|
|
5132
|
-
|
|
5133
5027
|
return val;
|
|
5134
5028
|
}
|
|
5135
|
-
|
|
5136
5029
|
each(['width', 'height'], function (name) {
|
|
5137
5030
|
var first = name.charAt(0).toUpperCase() + name.slice(1);
|
|
5138
|
-
|
|
5139
5031
|
domUtils["outer".concat(first)] = function (el, includeMargin) {
|
|
5140
5032
|
return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
|
|
5141
5033
|
};
|
|
5142
|
-
|
|
5143
5034
|
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
|
5144
|
-
|
|
5145
5035
|
domUtils[name] = function (elem, v) {
|
|
5146
5036
|
var val = v;
|
|
5147
|
-
|
|
5148
5037
|
if (val !== undefined) {
|
|
5149
5038
|
if (elem) {
|
|
5150
5039
|
var isBorderBox = isBorderBoxFn(elem);
|
|
5151
|
-
|
|
5152
5040
|
if (isBorderBox) {
|
|
5153
5041
|
val += getPBMWidth(elem, ['padding', 'border'], which);
|
|
5154
5042
|
}
|
|
5155
|
-
|
|
5156
5043
|
return css(elem, name, val);
|
|
5157
5044
|
}
|
|
5158
|
-
|
|
5159
5045
|
return undefined;
|
|
5160
5046
|
}
|
|
5161
|
-
|
|
5162
5047
|
return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
|
5163
5048
|
};
|
|
5164
5049
|
});
|
|
5165
|
-
|
|
5166
5050
|
function mix(to, from) {
|
|
5167
5051
|
for (var i in from) {
|
|
5168
5052
|
if (from.hasOwnProperty(i)) {
|
|
5169
5053
|
to[i] = from[i];
|
|
5170
5054
|
}
|
|
5171
5055
|
}
|
|
5172
|
-
|
|
5173
5056
|
return to;
|
|
5174
5057
|
}
|
|
5175
|
-
|
|
5176
5058
|
var utils = {
|
|
5177
5059
|
getWindow: function getWindow(node) {
|
|
5178
5060
|
if (node && node.document && node.setTimeout) {
|
|
5179
5061
|
return node;
|
|
5180
5062
|
}
|
|
5181
|
-
|
|
5182
5063
|
var doc = node.ownerDocument || node;
|
|
5183
5064
|
return doc.defaultView || doc.parentWindow;
|
|
5184
5065
|
},
|
|
@@ -5196,15 +5077,12 @@ var utils = {
|
|
|
5196
5077
|
clone: function clone(obj) {
|
|
5197
5078
|
var i;
|
|
5198
5079
|
var ret = {};
|
|
5199
|
-
|
|
5200
5080
|
for (i in obj) {
|
|
5201
5081
|
if (obj.hasOwnProperty(i)) {
|
|
5202
5082
|
ret[i] = obj[i];
|
|
5203
5083
|
}
|
|
5204
5084
|
}
|
|
5205
|
-
|
|
5206
5085
|
var overflow = obj.overflow;
|
|
5207
|
-
|
|
5208
5086
|
if (overflow) {
|
|
5209
5087
|
for (i in obj) {
|
|
5210
5088
|
if (obj.hasOwnProperty(i)) {
|
|
@@ -5212,7 +5090,6 @@ var utils = {
|
|
|
5212
5090
|
}
|
|
5213
5091
|
}
|
|
5214
5092
|
}
|
|
5215
|
-
|
|
5216
5093
|
return ret;
|
|
5217
5094
|
},
|
|
5218
5095
|
mix: mix,
|
|
@@ -5224,11 +5101,9 @@ var utils = {
|
|
|
5224
5101
|
},
|
|
5225
5102
|
merge: function merge() {
|
|
5226
5103
|
var ret = {};
|
|
5227
|
-
|
|
5228
5104
|
for (var i = 0; i < arguments.length; i++) {
|
|
5229
5105
|
utils.mix(ret, i < 0 || arguments.length <= i ? undefined : arguments[i]);
|
|
5230
5106
|
}
|
|
5231
|
-
|
|
5232
5107
|
return ret;
|
|
5233
5108
|
},
|
|
5234
5109
|
viewportWidth: 0,
|
|
@@ -5239,14 +5114,12 @@ mix(utils, domUtils);
|
|
|
5239
5114
|
/**
|
|
5240
5115
|
* 得到会导致元素显示不全的祖先元素
|
|
5241
5116
|
*/
|
|
5242
|
-
|
|
5243
5117
|
var getParent = utils.getParent;
|
|
5244
|
-
|
|
5245
5118
|
function getOffsetParent(element) {
|
|
5246
5119
|
if (utils.isWindow(element) || element.nodeType === 9) {
|
|
5247
5120
|
return null;
|
|
5248
|
-
}
|
|
5249
|
-
|
|
5121
|
+
}
|
|
5122
|
+
// ie 这个也不是完全可行
|
|
5250
5123
|
/*
|
|
5251
5124
|
<div style="width: 50px;height: 100px;overflow: hidden">
|
|
5252
5125
|
<div style="width: 50px;height: 100px;position: relative;" id="d6">
|
|
@@ -5261,26 +5134,20 @@ function getOffsetParent(element) {
|
|
|
5261
5134
|
// return element.offsetParent;
|
|
5262
5135
|
// }
|
|
5263
5136
|
// 统一的 offsetParent 方法
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
5137
|
var doc = utils.getDocument(element);
|
|
5267
5138
|
var body = doc.body;
|
|
5268
5139
|
var parent;
|
|
5269
5140
|
var positionStyle = utils.css(element, 'position');
|
|
5270
5141
|
var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
|
|
5271
|
-
|
|
5272
5142
|
if (!skipStatic) {
|
|
5273
5143
|
return element.nodeName.toLowerCase() === 'html' ? null : getParent(element);
|
|
5274
5144
|
}
|
|
5275
|
-
|
|
5276
5145
|
for (parent = getParent(element); parent && parent !== body && parent.nodeType !== 9; parent = getParent(parent)) {
|
|
5277
5146
|
positionStyle = utils.css(parent, 'position');
|
|
5278
|
-
|
|
5279
5147
|
if (positionStyle !== 'static') {
|
|
5280
5148
|
return parent;
|
|
5281
5149
|
}
|
|
5282
5150
|
}
|
|
5283
|
-
|
|
5284
5151
|
return null;
|
|
5285
5152
|
}
|
|
5286
5153
|
|
|
@@ -5289,27 +5156,23 @@ function isAncestorFixed(element) {
|
|
|
5289
5156
|
if (utils.isWindow(element) || element.nodeType === 9) {
|
|
5290
5157
|
return false;
|
|
5291
5158
|
}
|
|
5292
|
-
|
|
5293
5159
|
var doc = utils.getDocument(element);
|
|
5294
5160
|
var body = doc.body;
|
|
5295
5161
|
var parent = null;
|
|
5296
|
-
|
|
5297
|
-
|
|
5162
|
+
for (parent = getParent$1(element);
|
|
5163
|
+
// 修复元素位于 document.documentElement 下导致崩溃问题
|
|
5298
5164
|
parent && parent !== body && parent !== doc; parent = getParent$1(parent)) {
|
|
5299
5165
|
var positionStyle = utils.css(parent, 'position');
|
|
5300
|
-
|
|
5301
5166
|
if (positionStyle === 'fixed') {
|
|
5302
5167
|
return true;
|
|
5303
5168
|
}
|
|
5304
5169
|
}
|
|
5305
|
-
|
|
5306
5170
|
return false;
|
|
5307
5171
|
}
|
|
5308
5172
|
|
|
5309
5173
|
/**
|
|
5310
5174
|
* 获得元素的显示部分的区域
|
|
5311
5175
|
*/
|
|
5312
|
-
|
|
5313
5176
|
function getVisibleRectForElement(element, alwaysByViewport) {
|
|
5314
5177
|
var visibleRect = {
|
|
5315
5178
|
left: 0,
|
|
@@ -5321,68 +5184,65 @@ function getVisibleRectForElement(element, alwaysByViewport) {
|
|
|
5321
5184
|
var doc = utils.getDocument(element);
|
|
5322
5185
|
var win = doc.defaultView || doc.parentWindow;
|
|
5323
5186
|
var body = doc.body;
|
|
5324
|
-
var documentElement = doc.documentElement;
|
|
5325
|
-
// all scrollable containers.
|
|
5187
|
+
var documentElement = doc.documentElement;
|
|
5326
5188
|
|
|
5189
|
+
// Determine the size of the visible rect by climbing the dom accounting for
|
|
5190
|
+
// all scrollable containers.
|
|
5327
5191
|
while (el) {
|
|
5328
5192
|
// clientWidth is zero for inline block elements in ie.
|
|
5329
|
-
if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
|
|
5193
|
+
if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
|
|
5194
|
+
// body may have overflow set on it, yet we still get the entire
|
|
5330
5195
|
// viewport. In some browsers, el.offsetParent may be
|
|
5331
5196
|
// document.documentElement, so check for that too.
|
|
5332
5197
|
el !== body && el !== documentElement && utils.css(el, 'overflow') !== 'visible') {
|
|
5333
|
-
var pos = utils.offset(el);
|
|
5334
|
-
|
|
5198
|
+
var pos = utils.offset(el);
|
|
5199
|
+
// add border
|
|
5335
5200
|
pos.left += el.clientLeft;
|
|
5336
5201
|
pos.top += el.clientTop;
|
|
5337
5202
|
visibleRect.top = Math.max(visibleRect.top, pos.top);
|
|
5338
|
-
visibleRect.right = Math.min(visibleRect.right,
|
|
5203
|
+
visibleRect.right = Math.min(visibleRect.right,
|
|
5204
|
+
// consider area without scrollBar
|
|
5339
5205
|
pos.left + el.clientWidth);
|
|
5340
5206
|
visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
|
|
5341
5207
|
visibleRect.left = Math.max(visibleRect.left, pos.left);
|
|
5342
5208
|
} else if (el === body || el === documentElement) {
|
|
5343
5209
|
break;
|
|
5344
5210
|
}
|
|
5345
|
-
|
|
5346
5211
|
el = getOffsetParent(el);
|
|
5347
|
-
}
|
|
5212
|
+
}
|
|
5213
|
+
|
|
5214
|
+
// Set element position to fixed
|
|
5348
5215
|
// make sure absolute element itself don't affect it's visible area
|
|
5349
5216
|
// https://github.com/ant-design/ant-design/issues/7601
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
5217
|
var originalPosition = null;
|
|
5353
|
-
|
|
5354
5218
|
if (!utils.isWindow(element) && element.nodeType !== 9) {
|
|
5355
5219
|
originalPosition = element.style.position;
|
|
5356
5220
|
var position = utils.css(element, 'position');
|
|
5357
|
-
|
|
5358
5221
|
if (position === 'absolute') {
|
|
5359
5222
|
element.style.position = 'fixed';
|
|
5360
5223
|
}
|
|
5361
5224
|
}
|
|
5362
|
-
|
|
5363
5225
|
var scrollX = utils.getWindowScrollLeft(win);
|
|
5364
5226
|
var scrollY = utils.getWindowScrollTop(win);
|
|
5365
5227
|
var viewportWidth = utils.viewportWidth(win);
|
|
5366
5228
|
var viewportHeight = utils.viewportHeight(win);
|
|
5367
5229
|
var documentWidth = documentElement.scrollWidth;
|
|
5368
|
-
var documentHeight = documentElement.scrollHeight;
|
|
5369
|
-
// We should cut this ourself.
|
|
5230
|
+
var documentHeight = documentElement.scrollHeight;
|
|
5370
5231
|
|
|
5232
|
+
// scrollXXX on html is sync with body which means overflow: hidden on body gets wrong scrollXXX.
|
|
5233
|
+
// We should cut this ourself.
|
|
5371
5234
|
var bodyStyle = window.getComputedStyle(body);
|
|
5372
|
-
|
|
5373
5235
|
if (bodyStyle.overflowX === 'hidden') {
|
|
5374
5236
|
documentWidth = win.innerWidth;
|
|
5375
5237
|
}
|
|
5376
|
-
|
|
5377
5238
|
if (bodyStyle.overflowY === 'hidden') {
|
|
5378
5239
|
documentHeight = win.innerHeight;
|
|
5379
|
-
}
|
|
5380
|
-
|
|
5240
|
+
}
|
|
5381
5241
|
|
|
5242
|
+
// Reset element position after calculate the visible area
|
|
5382
5243
|
if (element.style) {
|
|
5383
5244
|
element.style.position = originalPosition;
|
|
5384
5245
|
}
|
|
5385
|
-
|
|
5386
5246
|
if (alwaysByViewport || isAncestorFixed(element)) {
|
|
5387
5247
|
// Clip by viewport's size.
|
|
5388
5248
|
visibleRect.left = Math.max(visibleRect.left, scrollX);
|
|
@@ -5396,7 +5256,6 @@ function getVisibleRectForElement(element, alwaysByViewport) {
|
|
|
5396
5256
|
var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
|
|
5397
5257
|
visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
|
|
5398
5258
|
}
|
|
5399
|
-
|
|
5400
5259
|
return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
|
|
5401
5260
|
}
|
|
5402
5261
|
|
|
@@ -5406,38 +5265,36 @@ function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
|
|
|
5406
5265
|
width: elRegion.width,
|
|
5407
5266
|
height: elRegion.height
|
|
5408
5267
|
};
|
|
5409
|
-
|
|
5410
5268
|
if (overflow.adjustX && pos.left < visibleRect.left) {
|
|
5411
5269
|
pos.left = visibleRect.left;
|
|
5412
|
-
}
|
|
5413
|
-
|
|
5270
|
+
}
|
|
5414
5271
|
|
|
5272
|
+
// Left edge inside and right edge outside viewport, try to resize it.
|
|
5415
5273
|
if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
|
|
5416
5274
|
size.width -= pos.left + size.width - visibleRect.right;
|
|
5417
|
-
}
|
|
5418
|
-
|
|
5275
|
+
}
|
|
5419
5276
|
|
|
5277
|
+
// Right edge outside viewport, try to move it.
|
|
5420
5278
|
if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
|
|
5421
5279
|
// 保证左边界和可视区域左边界对齐
|
|
5422
5280
|
pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
|
|
5423
|
-
}
|
|
5424
|
-
|
|
5281
|
+
}
|
|
5425
5282
|
|
|
5283
|
+
// Top edge outside viewport, try to move it.
|
|
5426
5284
|
if (overflow.adjustY && pos.top < visibleRect.top) {
|
|
5427
5285
|
pos.top = visibleRect.top;
|
|
5428
|
-
}
|
|
5429
|
-
|
|
5286
|
+
}
|
|
5430
5287
|
|
|
5288
|
+
// Top edge inside and bottom edge outside viewport, try to resize it.
|
|
5431
5289
|
if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
|
|
5432
5290
|
size.height -= pos.top + size.height - visibleRect.bottom;
|
|
5433
|
-
}
|
|
5434
|
-
|
|
5291
|
+
}
|
|
5435
5292
|
|
|
5293
|
+
// Bottom edge outside viewport, try to move it.
|
|
5436
5294
|
if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
|
|
5437
5295
|
// 保证上边界和可视区域上边界对齐
|
|
5438
5296
|
pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
|
|
5439
5297
|
}
|
|
5440
|
-
|
|
5441
5298
|
return utils.mix(pos, size);
|
|
5442
5299
|
}
|
|
5443
5300
|
|
|
@@ -5445,7 +5302,6 @@ function getRegion(node) {
|
|
|
5445
5302
|
var offset;
|
|
5446
5303
|
var w;
|
|
5447
5304
|
var h;
|
|
5448
|
-
|
|
5449
5305
|
if (!utils.isWindow(node) && node.nodeType !== 9) {
|
|
5450
5306
|
offset = utils.offset(node);
|
|
5451
5307
|
w = utils.outerWidth(node);
|
|
@@ -5459,7 +5315,6 @@ function getRegion(node) {
|
|
|
5459
5315
|
w = utils.viewportWidth(win);
|
|
5460
5316
|
h = utils.viewportHeight(win);
|
|
5461
5317
|
}
|
|
5462
|
-
|
|
5463
5318
|
offset.width = w;
|
|
5464
5319
|
offset.height = h;
|
|
5465
5320
|
return offset;
|
|
@@ -5468,6 +5323,7 @@ function getRegion(node) {
|
|
|
5468
5323
|
/**
|
|
5469
5324
|
* 获取 node 上的 align 对齐点 相对于页面的坐标
|
|
5470
5325
|
*/
|
|
5326
|
+
|
|
5471
5327
|
function getAlignOffset(region, align) {
|
|
5472
5328
|
var V = align.charAt(0);
|
|
5473
5329
|
var H = align.charAt(1);
|
|
@@ -5475,19 +5331,16 @@ function getAlignOffset(region, align) {
|
|
|
5475
5331
|
var h = region.height;
|
|
5476
5332
|
var x = region.left;
|
|
5477
5333
|
var y = region.top;
|
|
5478
|
-
|
|
5479
5334
|
if (V === 'c') {
|
|
5480
5335
|
y += h / 2;
|
|
5481
5336
|
} else if (V === 'b') {
|
|
5482
5337
|
y += h;
|
|
5483
5338
|
}
|
|
5484
|
-
|
|
5485
5339
|
if (H === 'c') {
|
|
5486
5340
|
x += w / 2;
|
|
5487
5341
|
} else if (H === 'r') {
|
|
5488
5342
|
x += w;
|
|
5489
5343
|
}
|
|
5490
|
-
|
|
5491
5344
|
return {
|
|
5492
5345
|
left: x,
|
|
5493
5346
|
top: y
|
|
@@ -5509,22 +5362,20 @@ function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
|
|
|
5509
5362
|
* @author yiminghe@gmail.com
|
|
5510
5363
|
*/
|
|
5511
5364
|
|
|
5365
|
+
// http://yiminghe.iteye.com/blog/1124720
|
|
5366
|
+
|
|
5512
5367
|
function isFailX(elFuturePos, elRegion, visibleRect) {
|
|
5513
5368
|
return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
|
|
5514
5369
|
}
|
|
5515
|
-
|
|
5516
5370
|
function isFailY(elFuturePos, elRegion, visibleRect) {
|
|
5517
5371
|
return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
|
|
5518
5372
|
}
|
|
5519
|
-
|
|
5520
5373
|
function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
|
|
5521
5374
|
return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
|
|
5522
5375
|
}
|
|
5523
|
-
|
|
5524
5376
|
function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
|
|
5525
5377
|
return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
|
|
5526
5378
|
}
|
|
5527
|
-
|
|
5528
5379
|
function flip(points, reg, map) {
|
|
5529
5380
|
var ret = [];
|
|
5530
5381
|
utils.each(points, function (p) {
|
|
@@ -5534,35 +5385,29 @@ function flip(points, reg, map) {
|
|
|
5534
5385
|
});
|
|
5535
5386
|
return ret;
|
|
5536
5387
|
}
|
|
5537
|
-
|
|
5538
5388
|
function flipOffset(offset, index) {
|
|
5539
5389
|
offset[index] = -offset[index];
|
|
5540
5390
|
return offset;
|
|
5541
5391
|
}
|
|
5542
|
-
|
|
5543
5392
|
function convertOffset(str, offsetLen) {
|
|
5544
5393
|
var n;
|
|
5545
|
-
|
|
5546
5394
|
if (/%$/.test(str)) {
|
|
5547
5395
|
n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
|
|
5548
5396
|
} else {
|
|
5549
5397
|
n = parseInt(str, 10);
|
|
5550
5398
|
}
|
|
5551
|
-
|
|
5552
5399
|
return n || 0;
|
|
5553
5400
|
}
|
|
5554
|
-
|
|
5555
5401
|
function normalizeOffset(offset, el) {
|
|
5556
5402
|
offset[0] = convertOffset(offset[0], el.width);
|
|
5557
5403
|
offset[1] = convertOffset(offset[1], el.height);
|
|
5558
5404
|
}
|
|
5405
|
+
|
|
5559
5406
|
/**
|
|
5560
5407
|
* @param el
|
|
5561
5408
|
* @param tgtRegion 参照节点所占的区域: { left, top, width, height }
|
|
5562
5409
|
* @param align
|
|
5563
5410
|
*/
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
5411
|
function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
|
5567
5412
|
var points = align.points;
|
|
5568
5413
|
var offset = align.offset || [0, 0];
|
|
@@ -5574,19 +5419,20 @@ function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
|
|
5574
5419
|
overflow = overflow || {};
|
|
5575
5420
|
var newOverflowCfg = {};
|
|
5576
5421
|
var fail = 0;
|
|
5577
|
-
var alwaysByViewport = !!(overflow && overflow.alwaysByViewport);
|
|
5578
|
-
|
|
5579
|
-
var visibleRect = getVisibleRectForElement(source, alwaysByViewport);
|
|
5580
|
-
|
|
5581
|
-
var elRegion = getRegion(source);
|
|
5582
|
-
|
|
5422
|
+
var alwaysByViewport = !!(overflow && overflow.alwaysByViewport);
|
|
5423
|
+
// 当前节点可以被放置的显示区域
|
|
5424
|
+
var visibleRect = getVisibleRectForElement(source, alwaysByViewport);
|
|
5425
|
+
// 当前节点所占的区域, left/top/width/height
|
|
5426
|
+
var elRegion = getRegion(source);
|
|
5427
|
+
// 将 offset 转换成数值,支持百分比
|
|
5583
5428
|
normalizeOffset(offset, elRegion);
|
|
5584
|
-
normalizeOffset(targetOffset, tgtRegion);
|
|
5585
|
-
|
|
5586
|
-
var elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset, targetOffset);
|
|
5587
|
-
|
|
5588
|
-
var newElRegion = utils.merge(elRegion, elFuturePos);
|
|
5429
|
+
normalizeOffset(targetOffset, tgtRegion);
|
|
5430
|
+
// 当前节点将要被放置的位置
|
|
5431
|
+
var elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset, targetOffset);
|
|
5432
|
+
// 当前节点将要所处的区域
|
|
5433
|
+
var newElRegion = utils.merge(elRegion, elFuturePos);
|
|
5589
5434
|
|
|
5435
|
+
// 如果可视区域不能完全放置当前节点时允许调整
|
|
5590
5436
|
if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
|
|
5591
5437
|
if (overflow.adjustX) {
|
|
5592
5438
|
// 如果横向不能放下
|
|
@@ -5595,12 +5441,11 @@ function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
|
|
5595
5441
|
var newPoints = flip(points, /[lr]/gi, {
|
|
5596
5442
|
l: 'r',
|
|
5597
5443
|
r: 'l'
|
|
5598
|
-
});
|
|
5599
|
-
|
|
5444
|
+
});
|
|
5445
|
+
// 偏移量也反下
|
|
5600
5446
|
var newOffset = flipOffset(offset, 0);
|
|
5601
5447
|
var newTargetOffset = flipOffset(targetOffset, 0);
|
|
5602
5448
|
var newElFuturePos = getElFuturePos(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
|
|
5603
|
-
|
|
5604
5449
|
if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
|
|
5605
5450
|
fail = 1;
|
|
5606
5451
|
points = newPoints;
|
|
@@ -5609,7 +5454,6 @@ function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
|
|
5609
5454
|
}
|
|
5610
5455
|
}
|
|
5611
5456
|
}
|
|
5612
|
-
|
|
5613
5457
|
if (overflow.adjustY) {
|
|
5614
5458
|
// 如果纵向不能放下
|
|
5615
5459
|
if (isFailY(elFuturePos, elRegion, visibleRect)) {
|
|
@@ -5617,15 +5461,11 @@ function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
|
|
5617
5461
|
var _newPoints = flip(points, /[tb]/gi, {
|
|
5618
5462
|
t: 'b',
|
|
5619
5463
|
b: 't'
|
|
5620
|
-
});
|
|
5621
|
-
|
|
5622
|
-
|
|
5464
|
+
});
|
|
5465
|
+
// 偏移量也反下
|
|
5623
5466
|
var _newOffset = flipOffset(offset, 1);
|
|
5624
|
-
|
|
5625
5467
|
var _newTargetOffset = flipOffset(targetOffset, 1);
|
|
5626
|
-
|
|
5627
5468
|
var _newElFuturePos = getElFuturePos(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
|
|
5628
|
-
|
|
5629
5469
|
if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
|
|
5630
5470
|
fail = 1;
|
|
5631
5471
|
points = _newPoints;
|
|
@@ -5633,61 +5473,58 @@ function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
|
|
5633
5473
|
targetOffset = _newTargetOffset;
|
|
5634
5474
|
}
|
|
5635
5475
|
}
|
|
5636
|
-
}
|
|
5637
|
-
|
|
5476
|
+
}
|
|
5638
5477
|
|
|
5478
|
+
// 如果失败,重新计算当前节点将要被放置的位置
|
|
5639
5479
|
if (fail) {
|
|
5640
5480
|
elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset, targetOffset);
|
|
5641
5481
|
utils.mix(newElRegion, elFuturePos);
|
|
5642
5482
|
}
|
|
5643
|
-
|
|
5644
5483
|
var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
|
|
5645
|
-
var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
|
|
5484
|
+
var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
|
|
5485
|
+
// 检查反下后的位置是否可以放下了,如果仍然放不下:
|
|
5646
5486
|
// 1. 复原修改过的定位参数
|
|
5647
|
-
|
|
5648
5487
|
if (isStillFailX || isStillFailY) {
|
|
5649
|
-
var _newPoints2 = points;
|
|
5488
|
+
var _newPoints2 = points;
|
|
5650
5489
|
|
|
5490
|
+
// 重置对应部分的翻转逻辑
|
|
5651
5491
|
if (isStillFailX) {
|
|
5652
5492
|
_newPoints2 = flip(points, /[lr]/gi, {
|
|
5653
5493
|
l: 'r',
|
|
5654
5494
|
r: 'l'
|
|
5655
5495
|
});
|
|
5656
5496
|
}
|
|
5657
|
-
|
|
5658
5497
|
if (isStillFailY) {
|
|
5659
5498
|
_newPoints2 = flip(points, /[tb]/gi, {
|
|
5660
5499
|
t: 'b',
|
|
5661
5500
|
b: 't'
|
|
5662
5501
|
});
|
|
5663
5502
|
}
|
|
5664
|
-
|
|
5665
5503
|
points = _newPoints2;
|
|
5666
5504
|
offset = align.offset || [0, 0];
|
|
5667
5505
|
targetOffset = align.targetOffset || [0, 0];
|
|
5668
|
-
}
|
|
5669
|
-
|
|
5670
|
-
|
|
5506
|
+
}
|
|
5507
|
+
// 2. 只有指定了可以调整当前方向才调整
|
|
5671
5508
|
newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
|
|
5672
|
-
newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
|
|
5509
|
+
newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
|
|
5673
5510
|
|
|
5511
|
+
// 确实要调整,甚至可能会调整高度宽度
|
|
5674
5512
|
if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
|
|
5675
5513
|
newElRegion = adjustForViewport(elFuturePos, elRegion, visibleRect, newOverflowCfg);
|
|
5676
5514
|
}
|
|
5677
|
-
}
|
|
5678
|
-
|
|
5515
|
+
}
|
|
5679
5516
|
|
|
5517
|
+
// need judge to in case set fixed with in css on height auto element
|
|
5680
5518
|
if (newElRegion.width !== elRegion.width) {
|
|
5681
5519
|
utils.css(source, 'width', utils.width(source) + newElRegion.width - elRegion.width);
|
|
5682
5520
|
}
|
|
5683
|
-
|
|
5684
5521
|
if (newElRegion.height !== elRegion.height) {
|
|
5685
5522
|
utils.css(source, 'height', utils.height(source) + newElRegion.height - elRegion.height);
|
|
5686
|
-
}
|
|
5523
|
+
}
|
|
5524
|
+
|
|
5525
|
+
// https://github.com/kissyteam/kissy/issues/190
|
|
5687
5526
|
// 相对于屏幕位置没变,而 left/top 变了
|
|
5688
5527
|
// 例如 <div 'relative'><el absolute></div>
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
5528
|
utils.offset(source, {
|
|
5692
5529
|
left: newElRegion.left,
|
|
5693
5530
|
top: newElRegion.top
|
|
@@ -5718,14 +5555,12 @@ function isOutOfVisibleRect(target, alwaysByViewport) {
|
|
|
5718
5555
|
var targetRegion = getRegion(target);
|
|
5719
5556
|
return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
|
|
5720
5557
|
}
|
|
5721
|
-
|
|
5722
5558
|
function alignElement(el, refNode, align) {
|
|
5723
5559
|
var target = align.target || refNode;
|
|
5724
5560
|
var refNodeRegion = getRegion(target);
|
|
5725
5561
|
var isTargetNotOutOfVisible = !isOutOfVisibleRect(target, align.overflow && align.overflow.alwaysByViewport);
|
|
5726
5562
|
return doAlign(el, refNodeRegion, align, isTargetNotOutOfVisible);
|
|
5727
5563
|
}
|
|
5728
|
-
|
|
5729
5564
|
alignElement.__getOffsetParent = getOffsetParent;
|
|
5730
5565
|
alignElement.__getVisibleRectForElement = getVisibleRectForElement;
|
|
5731
5566
|
|
|
@@ -5743,27 +5578,25 @@ function alignPoint(el, tgtPoint, align) {
|
|
|
5743
5578
|
var scrollY = utils.getWindowScrollTop(win);
|
|
5744
5579
|
var viewportWidth = utils.viewportWidth(win);
|
|
5745
5580
|
var viewportHeight = utils.viewportHeight(win);
|
|
5746
|
-
|
|
5747
5581
|
if ('pageX' in tgtPoint) {
|
|
5748
5582
|
pageX = tgtPoint.pageX;
|
|
5749
5583
|
} else {
|
|
5750
5584
|
pageX = scrollX + tgtPoint.clientX;
|
|
5751
5585
|
}
|
|
5752
|
-
|
|
5753
5586
|
if ('pageY' in tgtPoint) {
|
|
5754
5587
|
pageY = tgtPoint.pageY;
|
|
5755
5588
|
} else {
|
|
5756
5589
|
pageY = scrollY + tgtPoint.clientY;
|
|
5757
5590
|
}
|
|
5758
|
-
|
|
5759
5591
|
var tgtRegion = {
|
|
5760
5592
|
left: pageX,
|
|
5761
5593
|
top: pageY,
|
|
5762
5594
|
width: 0,
|
|
5763
5595
|
height: 0
|
|
5764
5596
|
};
|
|
5765
|
-
var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
|
|
5597
|
+
var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
|
|
5766
5598
|
|
|
5599
|
+
// Provide default target point
|
|
5767
5600
|
var points = [align.points[0], 'cc'];
|
|
5768
5601
|
return doAlign(el, tgtRegion, _objectSpread2(_objectSpread2({}, align), {}, {
|
|
5769
5602
|
points: points
|