Skip to content

Commit

Permalink
fix prettier errors
Browse files Browse the repository at this point in the history
  • Loading branch information
arcsi42 committed Mar 13, 2022
1 parent b6077ed commit 4cdfdea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ resources:
| `hold_action` | `map` | **Optional** | Action to take on hold. See [action options](#action-options) | `none` |
| `double_tap_action` | `map` | **Optional** | Action to take on double tap. See [action options](#action-options) | `action: none` |
| `theme` | `string` | **Optional** | Card theme | |
| `items_offset` | `number` | **Optional** | Distance of items from menu center | `0` |
| `items_offset` | `number` | **Optional** | Distance of items from menu center | `35` |

## Item Options

Expand Down
17 changes: 10 additions & 7 deletions src/radial-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class RadialMenu extends LitElement {
action: 'none',
},
default_dismiss: true,
items_offset: 0,
items_offset: 35,
...config,
};

Expand Down Expand Up @@ -81,15 +81,18 @@ export class RadialMenu extends LitElement {
<nav class="circular-menu">
<div class="circle">
${this._config.items.map((item, index) => {
const _items_offset = this._config?.items_offset ?? 35;
const left = this._config
? (50 - (35 + (this._config?.items_offset ?? 0)) * Math.cos(-0.5 * Math.PI - 2 * (1 / this._config.items.length) * index * Math.PI)).toFixed(
4,
) + '%'
? (
50 -
_items_offset * Math.cos(-0.5 * Math.PI - 2 * (1 / this._config.items.length) * index * Math.PI)
).toFixed(4) + '%'
: '';
const top = this._config
? (50 + (35 + (this._config?.items_offset ?? 0)) * Math.sin(-0.5 * Math.PI - 2 * (1 / this._config.items.length) * index * Math.PI)).toFixed(
4,
) + '%'
? (
50 +
_items_offset * Math.sin(-0.5 * Math.PI - 2 * (1 / this._config.items.length) * index * Math.PI)
).toFixed(4) + '%'
: '';
if (item.card && item.element) {
Expand Down

0 comments on commit 4cdfdea

Please sign in to comment.