mirror of
https://github.com/danbulant/node-x11
synced 2026-05-24 12:35:39 +00:00
use Array.slice
This commit is contained in:
parent
4ac7010e45
commit
04744a4a4c
1 changed files with 5 additions and 11 deletions
|
|
@ -30,19 +30,13 @@ xclient.on('connect', function(display) {
|
||||||
X.on('event', function(ev) {
|
X.on('event', function(ev) {
|
||||||
if (ev.type == 12)
|
if (ev.type == 12)
|
||||||
{
|
{
|
||||||
if (pts.length > 2)
|
if (pts.length > 4)
|
||||||
X.PolyLine(0, wid, gc, pts);
|
X.PolyLine(0, wid, gc, pts);
|
||||||
} else if (ev.type == 6) {
|
} else if (ev.type == 6) {
|
||||||
//pts.push(ev.x);
|
pts.push(ev.x);
|
||||||
//pts.push(ev.y);
|
pts.push(ev.y);
|
||||||
|
if (pts.length > 4)
|
||||||
//if (prevPoint)
|
X.PolyLine(0, wid, gc, pts.slice(-4));
|
||||||
// X.PolyLine(0, wid, gc, [prevPoint.x, prevPoint.y, ev.x, ev.y]);
|
|
||||||
//
|
|
||||||
//prevPoint = { x: ev.x, y: ev.y };
|
|
||||||
|
|
||||||
//if (pts.length > 2)
|
|
||||||
// X.PolyLine(0, wid, gc, pts);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue