@dolphinweex/weex-vue-render 0.2.105 → 0.2.106
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.common.js +27 -13
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -2674,11 +2674,17 @@ var info = {
|
|
|
2674
2674
|
|
|
2675
2675
|
/**
|
|
2676
2676
|
* set root font-size for rem units. If already been set, just skip this.
|
|
2677
|
+
* 横竖屏切换时应用短边作为设计宽度:避免页面在「窗口仍横屏」时 init,把 rem 锁成 83.7(长边/10),
|
|
2678
|
+
* 而正常竖屏基准应为 ~38.8;横屏布局仍沿用同一套 rem/scale。
|
|
2677
2679
|
*/
|
|
2678
2680
|
function setRootFont (width, viewportWidth, force) {
|
|
2679
2681
|
var doc = window.document;
|
|
2680
|
-
var rem = width * 750 / viewportWidth / 10;
|
|
2681
2682
|
if (!doc.documentElement) { return }
|
|
2683
|
+
var clientW = doc.documentElement.clientWidth || width;
|
|
2684
|
+
var clientH = doc.documentElement.clientHeight || width;
|
|
2685
|
+
// 短边基准:与竖屏 init 对齐,横屏下也不要把 rem 放大到长边
|
|
2686
|
+
var designWidth = Math.min(clientW, clientH) || width;
|
|
2687
|
+
var rem = designWidth * 750 / viewportWidth / 10;
|
|
2682
2688
|
var rootFontSize = doc.documentElement.style.fontSize;
|
|
2683
2689
|
if (!rootFontSize || force) {
|
|
2684
2690
|
doc.documentElement.style.fontSize = rem + 'px';
|
|
@@ -2728,11 +2734,15 @@ function init$1 (viewportWidth) {
|
|
|
2728
2734
|
}
|
|
2729
2735
|
|
|
2730
2736
|
dpr = info.dpr = window.devicePixelRatio;
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2737
|
+
// 用短边作为 rem/scale/deviceWidth 基准,避免横屏态下打开页面把 rem 锁成「长边/10」
|
|
2738
|
+
var rawW = doc.documentElement.clientWidth;
|
|
2739
|
+
var rawH = doc.documentElement.clientHeight;
|
|
2740
|
+
screenWidth = Math.min(rawW, rawH) || rawW;
|
|
2741
|
+
screenHeight = Math.max(rawW, rawH) || rawH;
|
|
2734
2742
|
var resetDeviceHeight = function () {
|
|
2735
|
-
|
|
2743
|
+
var rw = doc.documentElement.clientWidth;
|
|
2744
|
+
var rh = doc.documentElement.clientHeight;
|
|
2745
|
+
screenHeight = Math.max(rw, rh) || rh;
|
|
2736
2746
|
var env = window.weex && window.weex.config.env;
|
|
2737
2747
|
info.deviceHeight = env.deviceHeight = screenHeight * dpr;
|
|
2738
2748
|
};
|
|
@@ -2745,11 +2755,10 @@ function init$1 (viewportWidth) {
|
|
|
2745
2755
|
setTimeout(function () {
|
|
2746
2756
|
var newWidth = doc.documentElement.clientWidth;
|
|
2747
2757
|
var newHeight = doc.documentElement.clientHeight;
|
|
2748
|
-
|
|
2749
|
-
if (
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
screenHeight = newHeight;
|
|
2758
|
+
var designW = Math.min(newWidth, newHeight) || newWidth;
|
|
2759
|
+
if (designW > screenWidth && Math.abs(window.orientation || 0) !== 90) {
|
|
2760
|
+
screenWidth = designW;
|
|
2761
|
+
screenHeight = Math.max(newWidth, newHeight) || newHeight;
|
|
2753
2762
|
setRootFont(screenWidth, _viewportWidthForFix, true);
|
|
2754
2763
|
var newScale = screenWidth / _viewportWidthForFix;
|
|
2755
2764
|
document.documentElement.style.setProperty('--harmory-density-scale', newScale);
|
|
@@ -2801,10 +2810,18 @@ function init$1 (viewportWidth) {
|
|
|
2801
2810
|
* @return new scale.
|
|
2802
2811
|
*/
|
|
2803
2812
|
function resetViewport (viewportWidth) {
|
|
2813
|
+
var doc = window.document;
|
|
2814
|
+
if (doc && doc.documentElement) {
|
|
2815
|
+
var rawW = doc.documentElement.clientWidth;
|
|
2816
|
+
var rawH = doc.documentElement.clientHeight;
|
|
2817
|
+
screenWidth = Math.min(rawW, rawH) || rawW || screenWidth;
|
|
2818
|
+
screenHeight = Math.max(rawW, rawH) || rawH || screenHeight;
|
|
2819
|
+
}
|
|
2804
2820
|
setRootFont(screenWidth, viewportWidth, true);
|
|
2805
2821
|
setMetaViewport(viewportWidth);
|
|
2806
2822
|
var newScale = screenWidth / viewportWidth;
|
|
2807
2823
|
info.scale = newScale;
|
|
2824
|
+
document.documentElement.style.setProperty('--harmory-density-scale', newScale);
|
|
2808
2825
|
return newScale
|
|
2809
2826
|
}
|
|
2810
2827
|
|
|
@@ -8978,7 +8995,6 @@ var slideMixin = {
|
|
|
8978
8995
|
// 第一张在列表开头,不能脱离文档流,否则会导致当前最后一张区域出现黑块。
|
|
8979
8996
|
// 这里保留其布局位置,只做视觉位移到最右侧。
|
|
8980
8997
|
var firstNode = this._cells[0].elm;
|
|
8981
|
-
console.log('cdj-touchmove-last-to-first', { currentIndex: this.currentIndex, preIndex: this._preIndex, frameCount: this.frameCount });
|
|
8982
8998
|
firstNode.style.position = this.isTransform ? '' : 'relative';
|
|
8983
8999
|
this._setPosition(firstNode, this.frameCount * this._wrapperWidth);
|
|
8984
9000
|
firstNode.style.opacity = '1';
|
|
@@ -9077,7 +9093,6 @@ var slideMixin = {
|
|
|
9077
9093
|
}
|
|
9078
9094
|
|
|
9079
9095
|
var newIndex = shouldSwitch ? (this.currentIndex - direction) : this.currentIndex;
|
|
9080
|
-
console.log('cdj-touchend-decision', { currentIndex: this.currentIndex, preIndex: this._preIndex, newIndex: newIndex, moveRatio: moveRatio, velocity: this.velocity, shouldSwitch: shouldSwitch, duration: animationDuration });
|
|
9081
9096
|
|
|
9082
9097
|
// 边界检查
|
|
9083
9098
|
if (!this.infinite || this.infinite === 'false') {
|
|
@@ -9181,7 +9196,6 @@ var slideMixin = {
|
|
|
9181
9196
|
if (newIndex < 0) {
|
|
9182
9197
|
// 从第一张向右滑到最后一张
|
|
9183
9198
|
newIndex = this.frameCount - 1;
|
|
9184
|
-
console.log('cdj-smooth-boundary-first-to-last', { targetIndex: newIndex, innerOffset: this.innerOffset, wrapperWidth: this._wrapperWidth });
|
|
9185
9199
|
lastNode = this._cells[newIndex].elm;
|
|
9186
9200
|
lastNode.style.position = 'absolute';
|
|
9187
9201
|
this._setPosition(lastNode, -this._wrapperWidth);
|
package/package.json
CHANGED