Commit daeca6f5 authored by 任建锋's avatar 任建锋

--

parent 25a47f09
.zero-playground-body-center{ .zero-playground-body-center{
position: relative; position: relative;
width: 750px; width: 750px;
height: 1206px; height: 1624px;
margin: 10px auto; margin: 10px auto;
// max-height: 1200px; // max-height: 1200px;
background-color: transparent; background-color: transparent;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
overflow-x: hidden; //overflow-x: hidden;
overflow-y: auto; //overflow-y: auto;
/*transform: scale(.5, .5); /*transform: scale(.5, .5);
transform-origin: 50% 0%;*/ transform-origin: 50% 0%;*/
//zoom: 0.5; //zoom: 0.5;
......
<template> <template>
<pane icon="el-icon-s-open" class="pane-playground" :title="$t('panes.Playground')"> <pane icon="el-icon-s-open" class="pane-playground" :title="$t('panes.Playground')">
<div class="zero-playground-body-center" :style="playgroundStyle">
<div class="draw-body">
<div class="playground-con">
<!-- <label class="el-form-item__label">滑动滚轮进行缩放</label> -->
<el-button size="mini" @click="setZoom(true)"><i class="el-icon-plus"></i></el-button>
<el-input class="el-input el-input--mini" :value="parseInt(zoom*100)+'%'" style="width:60px" readonly/>
<el-button size="mini" @click="setZoom(false)"><i class="el-icon-minus"></i></el-button>
</div>
<div class="zero-playground-body-center" :style="playgroundStyle" >
<!-- <div class="zero-playground-draw-panel"> --> <!-- <div class="zero-playground-draw-panel"> -->
<draw-canvas-panel></draw-canvas-panel> <draw-canvas-panel></draw-canvas-panel>
<!-- </div> --> <!-- </div> -->
</div>
</div> </div>
</pane> </pane>
</template> </template>
...@@ -18,21 +28,51 @@ export default { ...@@ -18,21 +28,51 @@ export default {
name: 'Playground', name: 'Playground',
components: { Pane, DrawPanel,DrawCanvasPanel}, components: { Pane, DrawPanel,DrawCanvasPanel},
props: { props: {
zoom:0.5
},
data:{
}, },
data () {
return {
zoom:0.5,
hasCtrlState:false
}
},
methods: { methods: {
mouseWheel(e){ mouseWheel(e){
console.log(e) console.log(e)
console.log(this.hasCtrlState)
if(!this.hasCtrlState){
return;
}
if(e.deltaY>0){ if(e.deltaY>0){
this.zoom-=0.1 this.setZoom(false)
}else if(e.deltaY<0){ }else if(e.deltaY<0){
this.zoom+=0.1 this.setZoom(true)
} }
console.log(this.zoom) console.log(this.zoom)
events.$emit('setPlaygroundZoom', {zoom:this.zoom}); // this.$set(this.zoom, this.zoomj)
},
setZoom(state){
if(state){
if(this.zoom>=1.4){
this.zoom=1.4
}else{
this.zoom+=0.05
}
}else{
if(this.zoom<=0.2){
this.zoom=0.2
}else{
this.zoom-=0.05
}
}
// this.zoom=this.zoom.toFixed(2)
events.$emit('setPlaygroundZoom', {zoom:this.zoom});
},
keyDo(state){
console.log(state)
this.hasCtrlState=state;
} }
}, },
computed: { computed: {
...@@ -48,13 +88,46 @@ export default { ...@@ -48,13 +88,46 @@ export default {
created(){ created(){
//alert() //alert()
this.zoom=0.5; this.zoom=0.5;
document.body.addEventListener('mousewheel',(e)=>{ document.body.addEventListener('mousewheel',(e)=>{
this.mouseWheel(e) this.mouseWheel(e)
},false) },false)
document.onkeydown = (e)=>{
let key = window.event.keyCode;
if (key == 18) {
this.keyDo(true);
}
};
document.onkeyup = (e)=>{
let key = window.event.keyCode;
if (key == 18) {
this.keyDo(false);
}
};
},
mounted(){
events.$emit('setPlaygroundZoom', {zoom:this.zoom});
console.log(123)
} }
}; };
</script> </script>
<style scoped> <style scoped>
</style>
<style lang="scss">
.pane-playground{
}
.draw-body{
width:100%;
height: 100%;
overflow: auto;
}
.playground-con{
width: 100%;
height: 50px;
}
</style> </style>
\ No newline at end of file
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