Skip to content

Commit

Permalink
added items_offset config option
Browse files Browse the repository at this point in the history
  • Loading branch information
arcsi42 committed Mar 13, 2022
1 parent 688e6c9 commit c6c7e15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/radial-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class RadialMenu extends LitElement {
action: 'none',
},
default_dismiss: true,
items_offset: 0,
...config,
};

Expand Down Expand Up @@ -81,12 +82,12 @@ export class RadialMenu extends LitElement {
<div class="circle">
${this._config.items.map((item, index) => {
const left = this._config
? (50 - 35 * Math.cos(-0.5 * Math.PI - 2 * (1 / this._config.items.length) * index * Math.PI)).toFixed(
? (50 - (35 + (this._config?.items_offset ?? 0)) * Math.cos(-0.5 * Math.PI - 2 * (1 / this._config.items.length) * index * Math.PI)).toFixed(
4,
) + '%'
: '';
const top = this._config
? (50 + 35 * Math.sin(-0.5 * Math.PI - 2 * (1 / this._config.items.length) * index * Math.PI)).toFixed(
? (50 + (35 + (this._config?.items_offset ?? 0)) * Math.sin(-0.5 * Math.PI - 2 * (1 / this._config.items.length) * index * Math.PI)).toFixed(
4,
) + '%'
: '';
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface RadialMenuConfig {
hold_action?: ActionConfig;
items: RadialMenuItemConfig[];
theme?: string;
items_offset?: number;
}

export interface RadialMenuItemConfig {
Expand Down

0 comments on commit c6c7e15

Please sign in to comment.