mirror of
https://github.com/danbulant/node-x11
synced 2026-05-22 13:59:11 +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) {
|
||||
if (ev.type == 12)
|
||||
{
|
||||
if (pts.length > 2)
|
||||
if (pts.length > 4)
|
||||
X.PolyLine(0, wid, gc, pts);
|
||||
} else if (ev.type == 6) {
|
||||
//pts.push(ev.x);
|
||||
//pts.push(ev.y);
|
||||
|
||||
//if (prevPoint)
|
||||
// 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);
|
||||
pts.push(ev.x);
|
||||
pts.push(ev.y);
|
||||
if (pts.length > 4)
|
||||
X.PolyLine(0, wid, gc, pts.slice(-4));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue