Commit ad2cba02 by 李嘉林

热区加判断

parent 0f26750f
...@@ -152,17 +152,19 @@ Component({ ...@@ -152,17 +152,19 @@ Component({
.selectAll(".imgBox") .selectAll(".imgBox")
.boundingClientRect(rect => { .boundingClientRect(rect => {
rect && rect.map((item, index) => { rect && rect.map((item, index) => {
Math.ceil(item.width); if (imgList[index].imgWidth) {
console.log('imgBox-width', item, imgList[index]); Math.ceil(item.width);
let ratio = Math.ceil(item.width) / imgList[index].imgWidth; console.log('imgBox-width', item, imgList[index]);
console.log('ratio', ratio) let ratio = Math.ceil(item.width) / imgList[index].imgWidth;
imgList[index].hotList && imgList[index].hotList.forEach((item1, index1) => { console.log('ratio', ratio)
item1.renderWidth = item1.width * ratio; imgList[index].hotList && imgList[index].hotList.forEach((item1, index1) => {
item1.renderHeight = item1.height * ratio; item1.renderWidth = item1.width * ratio;
item1.renderTop = item1.top * ratio; item1.renderHeight = item1.height * ratio;
item1.renderLeft = item1.left * ratio; item1.renderTop = item1.top * ratio;
}) item1.renderLeft = item1.left * ratio;
console.log('imgList', imgList) })
console.log('imgList', imgList)
}
}) })
_this.setData({ _this.setData({
imgList, imgList,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment