瀏覽代碼

added padding for fisrt map item random positioning

bach 1 年之前
父節點
當前提交
73b5c911da
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/components/ConcernementMapItem.vue

+ 3 - 2
src/components/ConcernementMapItem.vue

@@ -223,9 +223,10 @@ export default {
       this.initMatterBody()
     },
     getRandomPos(){
+      let pad = 200;
       return {
-        x: this.ray/2 + Math.random()*(this.canvas.width - this.ray),
-        y: this.ray/2 + Math.random()*(this.canvas.height - this.ray)
+        x: pad + this.ray/2 + Math.random()*(this.canvas.width - this.ray - pad),
+        y: pad + this.ray/2 + Math.random()*(this.canvas.height - this.ray - pad)
       };
     },
     initMatterBody (){