课堂展示:白板bug修复

This commit is contained in:
白了个白 2024-12-26 16:27:39 +08:00
parent 00119e4a49
commit 0f51892d96
1 changed files with 25 additions and 3 deletions

View File

@ -1,6 +1,6 @@
<template>
<div class="whiteboart-container" :style="{ height: height + 'px' }">
<div class="canvasBox" ref="box" @mouseleave="handleMouseLeave" ></div>
<div class="canvasBox" ref="box" @mouseenter.capture="handleMouseEnter" @mouseleave.capture="handleMouseLeave"></div>
<div class="footerLeft" @click.stop
:style="type == 'design' ? ['top: 10px', 'justify-content: space-between'] : ['bottom: 10px', 'justify-content: center']">
@ -278,7 +278,7 @@
</template>
<script setup>
import { onMounted, ref, getCurrentInstance, watch, toRaw, nextTick, computed, reactive, defineProps, defineEmits } from 'vue'
import { onMounted, onBeforeUnmount, ref, getCurrentInstance, watch, toRaw, nextTick, computed, reactive, defineProps, defineEmits } from 'vue'
import TinyWhiteboard from 'whiteboard_lyc'
import ColorPicker from './components/ColorPicker.vue'
import {
@ -791,6 +791,25 @@ const init = () => {
})
}
const isMyCanvas = ref(false); //
const handleKeyDown=(event)=> {
// console.log(':', event.key);
// console.log(isMyCanvas.value,'??????????')
if(isMyCanvas.value == false){
event.stopPropagation();
// console.log(':', event.key);
}
}
/**
* 鼠标进入事件
*/
const handleMouseEnter = () => {
console.log('进入白板')
isMyCanvas.value = true;
document.addEventListener('keydown', handleKeyDown, true);
}
/**
* 课堂展示-鼠标离开白板监听事件该事件是避免选中状态在其他地方点击后退删除等事件会删除白板内选中的元素
*/
@ -798,7 +817,10 @@ const handleMouseLeave = () => {
console.log('离开白板')
// --
app.cancelActiveElement()
// TODO
//
isMyCanvas.value = false;
//
document.addEventListener('keydown', handleKeyDown, true);
};
//