Commit 3a9620d6 authored by zhengke's avatar zhengke

双击空白处 禁止插入文本

parent 33a1c95e
......@@ -68,7 +68,7 @@ const getErrorCode2text = (response: AxiosResponse): string => {
const service = Axios.create({
// process.env.VUE_APP_API_URL
//'http://reborn.oytour.com/api/common/post'
baseURL: 'http://reborn.oytour.com/api/common/post',
baseURL: process.env.VUE_APP_API_URL,
timeout: 20000,
headers: {
'User-Type': 'bus',
......
......@@ -111,6 +111,7 @@ import { injectKeySlideScale } from '@/types/injectKey'
import { removeAllRanges } from '@/utils/selection'
import { KEYS } from '@/configs/hotkey'
import { injectKeyDataSource } from '@/types/injectKey'
import { VIEWPORT_SIZE, VIEWPORT_VER_SIZE } from '@/configs/canvas'
import useViewportSize from './hooks/useViewportSize'
import useMouseSelection from './hooks/useMouseSelection'
......@@ -157,7 +158,7 @@ const {
canvasScale,
textFormatPainter,
} = storeToRefs(mainStore)
const { currentSlide, slides } = storeToRefs(useSlidesStore())
const { currentSlide, slides, viewportRatio } = storeToRefs(useSlidesStore())
const { ctrlKeyState, spaceKeyState } = storeToRefs(useKeyboardStore())
const viewportRef = ref<HTMLElement>()
......@@ -220,7 +221,6 @@ onMounted(() => {
// 点击画布的空白区域:清空焦点元素、设置画布焦点、清除文字选区、清空格式刷状态
const handleClickBlankArea = (e: MouseEvent) => {
console.log(e,slides.value[6])
if (activeElementIdList.value.length) mainStore.setActiveElementIdList([])
if (!spaceKeyState.value && e.button==0) updateMouseSelection(e)
else if(e.button==1) dragViewport(e)
......@@ -243,13 +243,15 @@ const handleDblClick = (e: MouseEvent) => {
const viewportRect = viewportRef.value.getBoundingClientRect()
const left = (e.pageX - viewportRect.x) / canvasScale.value
const top = (e.pageY - viewportRect.y) / canvasScale.value
createTextElement({
left,
top,
width: 200 / canvasScale.value, // 除以 canvasScale 是为了与点击选区创建的形式保持相同的宽度
height: 0,
})
const width = viewportRatio.value<1 ? VIEWPORT_SIZE : VIEWPORT_VER_SIZE
if(left<width && left>=0){
createTextElement({
left,
top,
width: 200 / canvasScale.value, // 除以 canvasScale 是为了与点击选区创建的形式保持相同的宽度
height: 0,
})
}
}
// 画布注销时清空格式刷状态
......
......@@ -12,7 +12,7 @@
<ThumbnailSlide
class="thumbnail"
:class="{ 'break-page': (index + 1) % count === 0 }"
v-for="(slide, index) in slides"
v-for="(slide, index) in newSlides"
:key="slide.id"
:slide="slide"
:size="viewportRatio<1 ? VIEWPORT_SIZE : VIEWPORT_VER_SIZE"
......@@ -80,6 +80,7 @@ const emit = defineEmits<{
}>()
const { slides, currentSlide, viewportRatio } = storeToRefs(useSlidesStore())
const newSlides = ref<Array<any>>([])
const pdfThumbnailsRef = ref<HTMLElement>()
const rangeType = ref<'all' | 'current'>('all')
......@@ -96,6 +97,16 @@ const expPDF = () => {
}
print(pdfThumbnailsRef.value, pageSize)
}
const formatSliders =()=>{
const width = viewportRatio.value<1 ? VIEWPORT_SIZE : VIEWPORT_VER_SIZE
slides.value.forEach((x)=>{
let item = JSON.parse(JSON.stringify(x))
item.elements = item.elements.filter(y=>y.left<width && (y.left+y.width)>=0)
newSlides.value.push(item)
})
}
formatSliders()
</script>
<style lang="scss" scoped>
......
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