1 Star 9 Fork 3

qq123/qcanvas

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
template2.html 3.97 KB
一键复制 编辑 原始数据 按行查看 历史
qq123 提交于 2021-07-27 09:44 . 增加线段类型
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="js/jquery.js"></script>
<link href="style/default.min.css" rel="stylesheet">
<link rel="stylesheet" href="style/style.css">
<script src="js/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="js/initTemp.js"></script>
</head>
<body>
<div class="qcanvas_lay">
<canvas id="qcanvas"></canvas>
</div>
<div class="code_lay">
<pre><code class="js">var qcanvas = new Qcanvas({
id:'qcanvas',
width:300,
height:200,
mousedown:function(e){
console.log('canvas mousedown');
},
mousemove:function(){
console.log('canvas mousemove');
},
mouseup:function(){
console.log('canvas mouseup');
},
mouseout:function(){
console.log('canvas mouseout');
}
});
var line1 = qcanvas.qline.line({
start:function(){return [100,50];},
end:[50,150],
color:'red',
like:'-',
withText:'可拖动',
drag:'vertical',
mouseout:function(e,position){
console.log(e);
console.log('line1 mouseout');
}
});
var line2 = qcanvas.qline.line({
start:function(){return [150,50];},
end:[0,20],
color:'blue',
like:'-',
withText:'可拖动',
mousemove:function(){
// console.log('dddd');
}
// drag:false
});
var line3 = qcanvas.qline.line({
start:function(){return [30,50];},
end:[150,60],
width:1,
like:'->',
color:'gray',
withText:'line3',
drag:false
});
var line4 = qcanvas.qline.line({
start:function(){return [100,123];},
end:[150,180],
width:1,
like:'-->',
color:'gray',
withText:'line4',
withTextAlign:'left',
drag:false
});
var line5 = qcanvas.qline.line({
start:[250,50],
end:[200,200],
width:1,
like:'<-->',
color:'gray',
withText:'虚线双向箭头',
withTextAlign:'left',
// drag:false
});
var line6 = qcanvas.qline.line({
start:[120,50],
end:[140,200],
width:1,
like:'<->',
color:'blue',
withText:'实线双向箭头',
withTextAlign:'left',
// drag:false
});
</code>
</pre>
</div>
</body>
<script src='Qcanvas.js'></script>
<script>
// var qcanvas = new Qcanvas(["qcanvas",300,200]);
var qcanvas = new Qcanvas({
id:'qcanvas',
width:300,
height:200,
mousedown:function(e){
console.log(e);
console.log('canvas mousedown');
},
mousemove:function(){
console.log('canvas mousemove');
},
mouseup:function(){
console.log('canvas mouseup');
},
mouseout:function(){
console.log('canvas mouseout');
}
});
var layer = qcanvas.qlayer.layer();
var line1 = qcanvas.qline.line({
start:function(){return [100,50];},
end:[50,150],
color:'red',
like:'-',
withText:'可拖动',
drag:'vertical',
mouseout:function(e,position){
console.log(e);
console.log('line1 mouseout');
}
});
var line2 = qcanvas.qline.line({
start:function(){return [150,50];},
end:[0,20],
color:'blue',
like:'-',
withText:'可拖动',
mousemove:function(){
// console.log('dddd');
}
// drag:false
});
var line3 = qcanvas.qline.line({
start:function(){return [30,50];},
end:[150,60],
width:1,
like:'->',
color:'gray',
withText:'line3',
drag:false
});
layer.push(line3);
var line4 = qcanvas.qline.line({
start:function(){return [100,123];},
end:[150,180],
width:1,
like:'-->',
color:'gray',
withText:'line4',
withTextAlign:'left',
drag:false
});
var line5 = qcanvas.qline.line({
start:[250,50],
end:[200,200],
width:1,
like:'<-->',
color:'gray',
withText:'虚线双向箭头',
withTextAlign:'left',
// drag:false
});
var line6 = qcanvas.qline.line({
start:[120,50],
end:[140,200],
width:1,
like:'<->',
color:'blue',
withText:'实线双向箭头',
withTextAlign:'left',
// drag:false
});
var line6 = qcanvas.qline.line({
start:[50,50],
end:[200,200],
width:1,
like:'<-',
color:'red',
withText:'实线单向箭头',
withTextAlign:'left',
// drag:false
});
var line6 = qcanvas.qline.line({
start:[100,50],
end:[200,220],
width:1,
like:'<--',
color:'red',
withText:'虚线单向箭头',
withTextAlign:'left',
// drag:false
});
</script>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lizhicheng99/qcanvas.git
[email protected]:lizhicheng99/qcanvas.git
lizhicheng99
qcanvas
qcanvas
gitee

搜索帮助