Commit 431b760a authored by 范雪寒's avatar 范雪寒

fix: 卡片距离微调

parent e83c8953
...@@ -521,16 +521,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -521,16 +521,15 @@ export class PlayComponent implements OnInit, OnDestroy {
initItem() { initItem() {
const picArr = this.picArr; const picArr = this.picArr;
const rate = 10; // 距离与图片比例 10:1 const itemWidth = (this.canvasWidth - 20 * this.mapScale) / picArr.length;
const itemWidth = (this.canvasWidth - 20 * this.mapScale) / (picArr.length + (picArr.length - 1) / rate);
const itemHeight = (this.canvasHeight - 100 * this.mapScale) / 2; const itemHeight = (this.canvasHeight - 100 * this.mapScale) / 2;
const itemSideLength = Math.min(itemWidth, itemHeight); const itemSideLength = Math.min(itemWidth, itemHeight);
const disW = itemSideLength / rate; const disW = 0;
const disH = (this.canvasHeight - itemSideLength * 2 - 120 * this.mapScale) / 2; const disH = (this.canvasHeight - itemSideLength * 2 - 120 * this.mapScale) / 2;
const offX = this.canvasWidth / 2 - (picArr.length - 1) * (itemSideLength + disW) / 2; const offX = this.canvasWidth / 2 - (picArr.length - 1) * (itemSideLength) / 2;
const offY = this.canvasHeight / 2 + 60 * this.mapScale; const offY = this.canvasHeight / 2 + 60 * this.mapScale;
...@@ -574,7 +573,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -574,7 +573,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let itemBg = new MySprite(); let itemBg = new MySprite();
itemBg.init(this.images.get('item_bg')); itemBg.init(this.images.get('item_bg'));
itemBg.setScaleXY(itemSideLength / itemBg.width); itemBg.setScaleXY(itemSideLength / itemBg.width);
itemBg.x = offX + i * (itemSideLength + disW); itemBg.x = offX + i * itemSideLength;
itemBg.y = offY - (disH + itemSideLength / 2); itemBg.y = offY - (disH + itemSideLength / 2);
let bgRect = new ShapeRect(); let bgRect = new ShapeRect();
...@@ -623,7 +622,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -623,7 +622,7 @@ export class PlayComponent implements OnInit, OnDestroy {
itemBg = new MySprite(); itemBg = new MySprite();
itemBg.init(this.images.get('item_bg')); itemBg.init(this.images.get('item_bg'));
itemBg.setScaleXY(itemSideLength / itemBg.width); itemBg.setScaleXY(itemSideLength / itemBg.width);
itemBg.x = offX + i * (itemSideLength * ((rate + 1) / rate)); itemBg.x = offX + i * itemSideLength;
itemBg.y = offY + (disH + itemSideLength / 2); itemBg.y = offY + (disH + itemSideLength / 2);
......
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