|
|
|
@ -383,7 +383,7 @@ export default { |
|
|
|
camOn: true, |
|
|
|
camOn: true, |
|
|
|
localStream: null, |
|
|
|
localStream: null, |
|
|
|
|
|
|
|
|
|
|
|
// 音频说话波形 |
|
|
|
// 音频说话音量波形 |
|
|
|
audioContext: null, |
|
|
|
audioContext: null, |
|
|
|
analyser: null, |
|
|
|
analyser: null, |
|
|
|
voiceLevels: Array(12).fill(1), |
|
|
|
voiceLevels: Array(12).fill(1), |
|
|
|
@ -398,6 +398,7 @@ export default { |
|
|
|
brushLineWidth: 3, |
|
|
|
brushLineWidth: 3, |
|
|
|
brushLineDash: [5, 5], |
|
|
|
brushLineDash: [5, 5], |
|
|
|
ctx: null, |
|
|
|
ctx: null, |
|
|
|
|
|
|
|
drawHistory: [], // 画笔历史记录(用于撤销) |
|
|
|
|
|
|
|
|
|
|
|
// ==================== 激光笔工具 ==================== |
|
|
|
// ==================== 激光笔工具 ==================== |
|
|
|
isLaserMode: false, |
|
|
|
isLaserMode: false, |
|
|
|
@ -751,15 +752,55 @@ export default { |
|
|
|
this.ctx.setLineDash(this.brushLineDash); |
|
|
|
this.ctx.setLineDash(this.brushLineDash); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 画笔开关 |
|
|
|
// 画笔开关(打开时自动清空画布) |
|
|
|
toggleDraw() { |
|
|
|
toggleDraw() { |
|
|
|
this.isDrawingMode = !this.isDrawingMode; |
|
|
|
this.isDrawingMode = !this.isDrawingMode; |
|
|
|
this.$message.info(this.isDrawingMode ? "画笔开启" : "画笔关闭"); |
|
|
|
if (this.isDrawingMode) { |
|
|
|
|
|
|
|
this.clearCanvas(); // 打开画笔 → 清空 |
|
|
|
|
|
|
|
this.$message.info("画笔开启(画布已清空)"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.$message.info("画笔关闭"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 清空画布 |
|
|
|
|
|
|
|
clearCanvas() { |
|
|
|
|
|
|
|
const canvas = this.$refs.drawingCanvas; |
|
|
|
|
|
|
|
if (!canvas || !this.ctx) return; |
|
|
|
|
|
|
|
this.ctx.clearRect(0, 0, canvas.width, canvas.height); |
|
|
|
|
|
|
|
this.drawHistory = []; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 撤销上一笔(右键) |
|
|
|
|
|
|
|
undoLastDraw() { |
|
|
|
|
|
|
|
if (this.drawHistory.length === 0) return; |
|
|
|
|
|
|
|
this.drawHistory.pop(); |
|
|
|
|
|
|
|
this.ctx.clearRect(0, 0, this.$refs.drawingCanvas.width, this.$refs.drawingCanvas.height); |
|
|
|
|
|
|
|
this.redrawAll(); |
|
|
|
|
|
|
|
this.$message.info("已撤销上一笔"); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 重新绘制所有历史 |
|
|
|
|
|
|
|
redrawAll() { |
|
|
|
|
|
|
|
this.drawHistory.forEach((item) => { |
|
|
|
|
|
|
|
this.ctx.beginPath(); |
|
|
|
|
|
|
|
this.ctx.moveTo(item.fromX, item.fromY); |
|
|
|
|
|
|
|
this.ctx.lineTo(item.toX, item.toY); |
|
|
|
|
|
|
|
this.ctx.strokeStyle = item.color; |
|
|
|
|
|
|
|
this.ctx.lineWidth = item.width; |
|
|
|
|
|
|
|
this.ctx.stroke(); |
|
|
|
|
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 开始绘制 |
|
|
|
// 开始绘制 |
|
|
|
startDrawing(e) { |
|
|
|
startDrawing(e) { |
|
|
|
if (!this.isDrawingMode) return; |
|
|
|
if (!this.isDrawingMode) return; |
|
|
|
|
|
|
|
// 右键 → 撤销 |
|
|
|
|
|
|
|
if (e.button === 2) { |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
this.undoLastDraw(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
this.drawing = true; |
|
|
|
this.drawing = true; |
|
|
|
const c = this.getCoord(e); |
|
|
|
const c = this.getCoord(e); |
|
|
|
this.lastX = c.x; |
|
|
|
this.lastX = c.x; |
|
|
|
@ -774,6 +815,17 @@ export default { |
|
|
|
this.ctx.moveTo(this.lastX, this.lastY); |
|
|
|
this.ctx.moveTo(this.lastX, this.lastY); |
|
|
|
this.ctx.lineTo(c.x, c.y); |
|
|
|
this.ctx.lineTo(c.x, c.y); |
|
|
|
this.ctx.stroke(); |
|
|
|
this.ctx.stroke(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 保存历史 |
|
|
|
|
|
|
|
this.drawHistory.push({ |
|
|
|
|
|
|
|
fromX: this.lastX, |
|
|
|
|
|
|
|
fromY: this.lastY, |
|
|
|
|
|
|
|
toX: c.x, |
|
|
|
|
|
|
|
toY: c.y, |
|
|
|
|
|
|
|
color: this.brushColor, |
|
|
|
|
|
|
|
width: this.brushLineWidth, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.lastX = c.x; |
|
|
|
this.lastX = c.x; |
|
|
|
this.lastY = c.y; |
|
|
|
this.lastY = c.y; |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -1137,7 +1189,6 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
|
<style lang="scss"> |
|
|
|
.meeting-container { |
|
|
|
.meeting-container { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
|