Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
liveAssistant_web_demo
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
继续操作前请注册或者登录。
Authored by
胡斌
2019-06-02 13:29:49 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
649ad610dc82fe8700eada988126e3a1f5dc1a76
649ad610
1 parent
69007b30
add method use line to compare with use arc
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
62 行增加
和
18 行删除
demo.html
demo.html
查看文件 @
649ad61
...
...
@@ -371,25 +371,58 @@
drawMouse
();
}
var
draw_method
=
0
;
/*
function
draw_method_change
(){
draw_method
=
document
.
getElementById
(
"draw_method"
).
selectedIndex
;
}
function
draw_ext_input
(
px
,
py
,
p
)
{
if
(
draw_method
==
0
)
{
draw_ext_input_arc
(
px
,
py
,
p
);
}
else
if
(
draw_method
==
1
)
{
draw_ext_input_line
(
px
,
py
,
p
);
}
}
var
last_ext_press
=
0
;
function draw_ext_input(px,py,press) {
var
last_x
=
0
;
var
last_y
=
0
;
function
draw_ext_input_line
(
px
,
py
,
p
)
{
x
=
px
*
ratio_x
;
y
=
py
*
ratio_y
;
if(last_ext_press == 0 && press != 0){
if
(
last_ext_press
==
0
){
if
(
p
!=
0
)
{
ctx
.
beginPath
();
ctx
.
lineWidth
=
(
kWIDTH_MAX
-
kWIDTH_MIN
)
/
pressure_level
*
p
+
kWIDTH_MIN
;
ctx
.
moveTo
(
x
,
y
);
ctx
.
lineTo
(
x
,
y
);
ctx
.
stroke
();
last_x
=
x
;
last_y
=
y
;
}
}
else
if
(
p
!=
0
)
{
ctx
.
beginPath
();
ctx.moveTo(x, y);
last_ext_press = 1;
ctx
.
lineWidth
=
(
kWIDTH_MAX
-
kWIDTH_MIN
)
/
pressure_level
*
p
+
kWIDTH_MIN
;
ctx
.
moveTo
(
last_x
,
last_y
);
ctx
.
lineTo
(
x
,
y
);
ctx
.
stroke
();
last_x
=
x
;
last_y
=
y
;
}
else if(press != 0) {
var line_width = (kWIDTH_MAX - kWIDTH_MIN)/pressure_level * p + kWIDTH_MIN;
else
{
ctx
.
beginPath
();
ctx
.
lineWidth
=
(
kWIDTH_MAX
-
kWIDTH_MIN
)
/
pressure_level
*
last_ext_press
+
kWIDTH_MIN
;
ctx
.
moveTo
(
last_x
,
last_y
);
ctx
.
lineTo
(
x
,
y
);
ctx
.
stroke
();
}
last_ext_press = press;
}*/
last_ext_press
=
p
;
}
function
Point
(
x
,
y
,
p
)
{
this
.
x
=
x
;
this
.
y
=
y
;
...
...
@@ -406,13 +439,17 @@
var
rotate_degree
=
0
;
var
pressure_level
=
2048.0
-
1
;
function
draw_ext_input
(
px
,
py
,
press
)
{
function
draw_ext_input
_arc
(
px
,
py
,
press
)
{
if
(
press
==
0
)
{
previousPoint
.
p
=
0
;
}
else
{
currentPoint
.
x
=
Math
.
round
(
px
*
ratio_x
);
currentPoint
.
y
=
Math
.
round
(
py
*
ratio_y
);
//currentPoint.x = Math.round( px * ratio_x);
//currentPoint.y = Math.round( py * ratio_y);
currentPoint
.
x
=
px
*
ratio_x
;
currentPoint
.
y
=
py
*
ratio_y
;
currentPoint
.
p
=
press
;
if
(
previousPoint
.
p
==
0
)
{
...
...
@@ -455,7 +492,8 @@
function
draw_point
(
pt
){
var
line_width
=
(
kWIDTH_MAX
-
kWIDTH_MIN
)
/
pressure_level
*
pt
.
p
+
kWIDTH_MIN
;
ctx
.
beginPath
();
//Start path
ctx
.
arc
(
pt
.
x
,
pt
.
y
,
line_width
,
0
,
Math
.
PI
*
2
,
true
);
// Draw a point using the arc function of the canvas with a point structure.
ctx
.
lineWidth
=
0.1
;
ctx
.
arc
(
pt
.
x
,
pt
.
y
,
line_width
/
2
,
0
,
Math
.
PI
*
2
,
true
);
// Draw a point using the arc function of the canvas with a point structure.
ctx
.
fill
();
previousWidth
=
line_width
;
}
...
...
@@ -506,16 +544,21 @@
while
(
times
>
0
)
{
times
=
times
-
1
;
ctx
.
lineWidth
=
w
;
ctx
.
beginPath
();
//Start path
ctx
.
arc
(
x
,
y
,
w
,
0
,
Math
.
PI
*
2
,
true
);
// Draw a point using the arc function of the canvas with a point structure.
if
(
w
<
kWIDTH_MIN
)
{
w
=
kWIDTH_MIN
;
}
ctx
.
arc
(
x
,
y
,
w
/
2
,
0
,
Math
.
PI
*
2
,
true
);
// Draw a point using the arc function of the canvas with a point structure.
ctx
.
fill
();
x
+=
stepx
;
y
+=
stepy
;
w
+=
stepw
;
}
ctx
.
beginPath
();
//Start path
ctx
.
arc
(
pt
.
x
,
pt
.
y
,
w1
/
2
,
0
,
Math
.
PI
*
2
,
true
);
// Draw a point using the arc function of the canvas with a point structure.
ctx
.
fill
();
previousWidth
=
w1
;
}
...
...
@@ -2016,7 +2059,7 @@
</div>
<table
width =
"
5
00"
align=
"top"
>
<table
width =
"
6
00"
align=
"top"
>
<tr>
<td><label
for=
"line_width"
style=
"color:#a3bd97;"
>
line width:
</label></td>
<td>
...
...
@@ -2030,6 +2073,7 @@
<td><input
type=
"text"
id=
"line_width"
size=
"10"
readonly
style=
"border:0; color:#f6931f; font-weight:bold;"
/></td>
>
<td
colspan=
"2"
><select
id=
"pen_type"
name=
"pen_type"
><option
value =
"PendoTech"
>
PendoTech PH-1820-A
</option><option
value =
"robot"
>
Nebula T7
</option></select></td>
<td
colspan=
"2"
><select
id=
"draw_method"
name=
"draw_method"
onchange=
'javascript:draw_method_change();'
><option
value =
"use_arc"
>
use arc
</option><option
value =
"use_line"
>
use line
</option></select></td>
</tr>
</table>
</div>
...
...
请
注册
或
登录
后发表评论