Skip to content

Commit

Permalink
Fix robot position
Browse files Browse the repository at this point in the history
  • Loading branch information
nboissel committed Apr 9, 2020
1 parent ce1b8c0 commit 299f19c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The result is produced in SVG to allow clean integration in picture-elements car
Add the `rockrobo-path-card.js` file in your module folder (e.g. `/www/modules/`) then add the import in `ui-lovelace.yaml` configuration:
```yaml
resources:
- url: /local/modules/rockrobo-path-card.js?v=1.0.0
- url: /local/modules/rockrobo-path-card.js?v=1.0.1
type: module
```
Expand Down Expand Up @@ -60,7 +60,7 @@ It's highly recommended to exclude the sensor from recorder to keep database sma
recorder:
exclude:
entities:
- sensor.xiaomi_map
- sensor.vacuum_map
```

## Options
Expand Down
4 changes: 2 additions & 2 deletions rockrobo-path-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class RockroboPathCard extends HTMLElement {

const vacuumImage = document.createElementNS(ns, 'image');
vacuumImage.setAttributeNS('http://www.w3.org/1999/xlink', 'href', vacuumLink);
vacuumImage.setAttributeNS(null, 'x', Math.round(robotPosition[0] / 10.0));
vacuumImage.setAttributeNS(null, 'y', Math.round(robotPosition[1] / 10.0));
vacuumImage.setAttributeNS(null, 'x', Math.round(robotPosition[0] / 10.0) - this._config.vacuum_scale * 10);
vacuumImage.setAttributeNS(null, 'y', Math.round(robotPosition[1] / 10.0) - this._config.vacuum_scale * 10);
vacuumImage.setAttributeNS(null, 'transform', `rotate(${robotAngle}deg)`);
vacuumImage.setAttributeNS(null, 'width', `${this._config.vacuum_scale}vw`);
vacuumImage.setAttributeNS(null, 'height', `${this._config.vacuum_scale}vw`);
Expand Down

0 comments on commit 299f19c

Please sign in to comment.