张延森 před 2 roky
rodič
revize
8db479b71d
2 změnil soubory, kde provedl 8 přidání a 2 odebrání
  1. 3
    2
      src/App.vue
  2. 5
    0
      src/components/Mask.vue

+ 3
- 2
src/App.vue Zobrazit soubor

24
 <template>
24
 <template>
25
   <Loader :loading="loading" :percent="percent" />
25
   <Loader :loading="loading" :percent="percent" />
26
   <ScrollDown />
26
   <ScrollDown />
27
-  <Image v-for="(res, inx) in resources" :key="res.image" :resource="res"></Image>
27
+  <Image v-for="res in resources" :key="res.image" :resource="res"></Image>
28
 </template>
28
 </template>
29
 
29
 
30
-<style scoped>
30
+<style lang="less" scoped>
31
+
31
 </style>
32
 </style>

+ 5
- 0
src/components/Mask.vue Zobrazit soubor

22
   img.src = indexImage;
22
   img.src = indexImage;
23
   img.onload = function() {
23
   img.onload = function() {
24
     const canv = cvsRef.value;
24
     const canv = cvsRef.value;
25
+
26
+    const { clientWidth, clientHeight } = document.body;
27
+    canv.style.width = `${clientWidth}px`;
28
+    canv.style.height = `${img.naturalHeight * clientWidth / img.naturalWidth}px`;
29
+
25
     canv.width = img.naturalWidth;
30
     canv.width = img.naturalWidth;
26
     canv.height = img.naturalHeight;
31
     canv.height = img.naturalHeight;
27
   }
32
   }