cortico-world-hands 0.20.42 → 0.20.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +11 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1457,7 +1457,7 @@ var Hands = class {
1457
1457
  return res.body.toString("utf8");
1458
1458
  }
1459
1459
  /** 画板:新开一张。 */
1460
- async canvasNew(w = 512, h = 512, bg = "transparent") {
1460
+ async canvasNew(w = 768, h = 768, bg = "transparent") {
1461
1461
  const cfg = this.cfg();
1462
1462
  const credential = this.readToken();
1463
1463
  const t = credential ? `&t=${encodeURIComponent(credential)}` : "";
@@ -1465,29 +1465,31 @@ var Hands = class {
1465
1465
  return res.body.toString("utf8");
1466
1466
  }
1467
1467
  /** 画板:画一笔。 */
1468
- async canvasStroke(points, color = "#111111", width = 4, tool = "pen") {
1468
+ async canvasStroke(points, color = "#111111", width = 2, tool = "pen") {
1469
1469
  const cfg = this.cfg();
1470
1470
  const credential = this.readToken();
1471
1471
  const t = credential ? `t=${encodeURIComponent(credential)}` : "";
1472
- const body = JSON.stringify({ points, color, width });
1472
+ const body = JSON.stringify({ points, color, width, tool });
1473
1473
  const res = await post(this.port(cfg.handPort), `/canvas/stroke?${t}`, body, ACTION_TIMEOUT_MS);
1474
1474
  return res.body.toString("utf8");
1475
1475
  }
1476
1476
  /** 画板:油漆桶填充。 */
1477
1477
  async canvasFill(x, y, color = "#6BFFB0") {
1478
1478
  const cfg = this.cfg();
1479
- const t = cfg.token ? `t=${encodeURIComponent(cfg.token)}` : "";
1479
+ const credential = this.readToken();
1480
+ const t = credential ? `t=${encodeURIComponent(credential)}` : "";
1480
1481
  const body = JSON.stringify({ x, y, color });
1481
- const res = await post(this.port(cfg.handPort), `/canvas/fill?${t}`, body, ACTION_TIMEOUT_MS);
1482
- return res.text;
1482
+ const res = await post(this.port(cfg.handPort), `/canvas/fill?${t}`, body, 15e3);
1483
+ return res.body.toString("utf8");
1483
1484
  }
1484
1485
  /** 画板:写文字(支持中文)。 */
1485
1486
  async canvasText(text, x = 24, y = 72, size = 32, color = "#111111") {
1486
1487
  const cfg = this.cfg();
1487
- const t = cfg.token ? `t=${encodeURIComponent(cfg.token)}` : "";
1488
+ const credential = this.readToken();
1489
+ const t = credential ? `t=${encodeURIComponent(credential)}` : "";
1488
1490
  const body = JSON.stringify({ text, x, y, size, color });
1489
- const res = await post(this.port(cfg.handPort), `/canvas/text?${t}`, body, ACTION_TIMEOUT_MS);
1490
- return res.text;
1491
+ const res = await post(this.port(cfg.handPort), `/canvas/text?${t}`, body, 15e3);
1492
+ return res.body.toString("utf8");
1491
1493
  }
1492
1494
  /** 画板:撤销 / 清空 / 保存 / 列表。 */
1493
1495
  async canvasOp(op) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.42",
3
+ "version": "0.20.43",
4
4
  "type": "module",
5
5
  "description": "Cortico World: hands for the desktop pet — looks at the phone screen, then taps, swipes, pinches, drags, types and presses keys through whatever actuator the device actually has",
6
6
  "license": "MIT",