Commit abc060e0 authored by 黄奎's avatar 黄奎
parents bb2194a9 30f21b76
......@@ -3,7 +3,7 @@
.SignName .CanvasDiv{
width: 100%;
height: calc(100% - 8rem);
padding-top: 5%;
padding-top: 20px;
}
.SignName .CanvasDiv #canvas{
width: 100%;
......@@ -103,6 +103,7 @@
</template>
<script>
import tripBusOrderVue from './busManagement/tripBusOrder.vue';
let canvas = document.createElement("canvas");
let cxt = canvas.getContext("2d");
export default {
......@@ -165,6 +166,37 @@ export default {
}.bind(this),
false
);
//开始绘制
canvas.addEventListener(
"mousedown",
function(e) {
this.isMouseDown = tripBusOrderVue
cxt.beginPath();
cxt.lineWidth = linewidth; //当前线条的宽度,以像素计
cxt.moveTo(e.pageX - 20, e.pageY - 20);
}.bind(this),
false
);
//绘制中
canvas.addEventListener(
"mousemove",
function(e) {
if(this.isMouseDown) {
cxt.lineTo(e.pageX - 20, e.pageY - 20);
cxt.stroke();
}
}.bind(this),
false
);
//结束绘制
canvas.addEventListener(
"mouseup",
function() {
this.isMouseDown = false
cxt.closePath();
}.bind(this),
false
);
},
handelClearEl() {
cxt.clearRect(0, 0, canvas.width, canvas.height);
......
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