generated from theripper93/FoundryVTT-Module-Template
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c429a6a
commit 4af947b
Showing
9 changed files
with
145 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { ArgonComponent } from "../component.js"; | ||
|
||
|
||
export class Effect extends ArgonComponent { | ||
constructor(effect) { | ||
super(); | ||
this.effect = effect; | ||
} | ||
|
||
get classes() { | ||
return ["effect-icon"]; | ||
} | ||
|
||
get label() { | ||
return this.effect.name; | ||
} | ||
|
||
get icon() { | ||
return this.effect.img; | ||
} | ||
|
||
get colorScheme() { | ||
return 0; | ||
} | ||
|
||
get hasTooltip() { | ||
return true; | ||
} | ||
|
||
async getTooltipData() { | ||
return { | ||
title: this.label, | ||
description: await TextEditor.enrichHTML(this.effect.tooltip), | ||
}; | ||
} | ||
|
||
async getData() { | ||
return { | ||
label: this.label, | ||
icon: this.icon, | ||
}; | ||
} | ||
|
||
activateListeners(html) { | ||
this.element.onmouseup = this._onMouseUp.bind(this); | ||
this.element.onmousedown = this._onMouseDown.bind(this); | ||
this.element.onmouseenter = this._onMouseEnter.bind(this); | ||
this.element.onmouseleave = this._onMouseLeave.bind(this); | ||
} | ||
|
||
async _onMouseDown(event) {} | ||
|
||
async _onMouseUp(event) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
if (event.button === 0) this._onLeftClick(event); | ||
if (event.button === 2) this._onRightClick(event); | ||
} | ||
|
||
async _onMouseEnter(event) {} | ||
|
||
async _onMouseLeave(event) {} | ||
|
||
async _onLeftClick(event) { | ||
console.error("ActionButton._onLeftClick not implemented"); | ||
} | ||
|
||
async _onRightClick(event) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
<img src="{{icon}}" alt="{{label}}" /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters