113 lines
2.8 KiB
Vue
113 lines
2.8 KiB
Vue
<script setup>
|
|
import CloseIcon from '../assets/icons/close.svg'
|
|
import LikeIcon from '../assets/icons/like.svg'
|
|
</script>
|
|
|
|
<template>
|
|
<div id="visualizerPannel" class="windowStyle" ref="visualizerPannel" @mousedown="$emit('focus')" @touchstart="$emit('focus')">
|
|
<Moveable
|
|
className="moveable"
|
|
:target="target"
|
|
:draggable="true"
|
|
@drag="onDrag"
|
|
/>
|
|
<div class="windowTitle">
|
|
<p>
|
|
{{selectedImg.caption}}
|
|
</p>
|
|
<!-- touchstart.capture pour passer en prio sur déplacement fenêtre/ .stop si pas de method-->
|
|
<button type="button" class="closeBtn" @mousedown.capture="$emit('close')" @touchstart.capture="$emit('close')" data-tooltip="fermer">
|
|
<CloseIcon name="close" class="icon"/>
|
|
</button>
|
|
</div>
|
|
<div class="windowContent" id="visualizerContent">
|
|
<img :src="selectedImg.src" id="displayedImgStyle" :alt="selectedImg.alt">
|
|
<div class="reactBar">
|
|
<p class="reactStatStyle">{{selectedImg.like}}</p>
|
|
<button data-tooltip="j'aime bien" type="button" class="iconBtnStyle" :class="{reactedStyle: selectedImg.isLiked}" @mousedown.capture="likeImg" @touchstart.capture="likeImg">
|
|
<LikeIcon name="test" class="icon"/>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
/*================= Mise en page:
|
|
=> Mobile First : par défaut, moins de 500px
|
|
=> Tablette et PC format haut : de 500 à 1000px
|
|
=> PC large : à partir de 1000px
|
|
*/
|
|
|
|
/*+++++++++++++++++ COPYBOX
|
|
================ PC HAUT/IPAD
|
|
@media(min-width:650px){}
|
|
================ PC LARGE
|
|
@media(min-width:1300px){}
|
|
*/
|
|
|
|
#visualizerPannel{
|
|
position: fixed;
|
|
width: 333px;
|
|
height: auto;
|
|
top: 500px;
|
|
left: 16.1px;
|
|
border-radius: 16.1px;
|
|
}
|
|
|
|
#visualizerContent{
|
|
align-items: flex-start;
|
|
}
|
|
|
|
#displayedImgStyle{
|
|
width:100%;
|
|
height:auto;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
/*================ PC LARGE*/
|
|
@media(min-width:1300px){
|
|
#visualizerPannel{
|
|
top: 333px;
|
|
left: 161px;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
import Moveable from 'vue3-moveable';
|
|
import { dataStorage } from '../dataExchange.js'
|
|
|
|
export default {
|
|
name : 'VisualizerPannel',
|
|
components:{
|
|
Moveable
|
|
},
|
|
data(){
|
|
return{
|
|
target: null
|
|
}
|
|
},
|
|
emits: ['close','focus'],
|
|
computed: {
|
|
selectedImg(){
|
|
return dataStorage.selectedImg
|
|
}
|
|
},
|
|
methods:{
|
|
onDrag({ target, transform }) {
|
|
target.style.transform = transform;
|
|
},
|
|
likeImg(){
|
|
this.selectedImg.isLiked = !this.selectedImg.isLiked;
|
|
console.log(this.selectedImg);
|
|
}
|
|
},
|
|
mounted(){
|
|
this.target = this.$refs.visualizerPannel;
|
|
console.log("Visualizer pannel is loaded!");
|
|
}
|
|
};
|
|
</script>
|