From 48029e0a1d482ec9a5545f7743c1559b45fe7bfc Mon Sep 17 00:00:00 2001 From: alexchx Date: Sun, 7 May 2017 16:52:42 +0800 Subject: [PATCH 1/2] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 自动识别图片在屏幕上边距,imagePadding --- wxParse/wxParse.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wxParse/wxParse.js b/wxParse/wxParse.js index ea4b6b0..7f16467 100644 --- a/wxParse/wxParse.js +++ b/wxParse/wxParse.js @@ -75,7 +75,7 @@ function calMoreImageInfo(e, idx, that, bindName) { } var temImages = temData.images; //因为无法获取view宽度 需要自定义padding进行计算,稍后处理 - var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName); + var recal = wxAutoImageCal(e.detail.width, e.detail.height,e.currentTarget.offsetLeft,that,bindName); temImages[idx].width = recal.imageWidth; temImages[idx].height = recal.imageheight; temData.images = temImages; @@ -85,14 +85,14 @@ function calMoreImageInfo(e, idx, that, bindName) { } // 计算视觉优先的图片宽高 -function wxAutoImageCal(originalWidth, originalHeight,that,bindName) { +function wxAutoImageCal(originalWidth, originalHeight, imgOffsetLeftOnScreen, that,bindName) { //获取图片的原始长宽 var windowWidth = 0, windowHeight = 0; var autoWidth = 0, autoHeight = 0; var results = {}; wx.getSystemInfo({ success: function (res) { - var padding = that.data[bindName].view.imagePadding; + var padding = that.data[bindName].view.imagePadding + imgOffsetLeftOnScreen; windowWidth = res.windowWidth-2*padding; windowHeight = res.windowHeight; //判断按照那种方式进行缩放 From ba71f08d85a8fb2131c1be8f9ddb8787f0c2f2f5 Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Mon, 21 May 2018 09:58:55 +0800 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b7706b9..0b57dc4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +updated for my test +