Skip to content

Commit

Permalink
Finished UI design
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyEdmonds committed Aug 15, 2024
1 parent ac76677 commit 4f3f7a9
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 306 deletions.
18 changes: 8 additions & 10 deletions AuraRing.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Form } from "./Form.js";

export class AuraRing extends foundry.abstract.DataModel {
// TODO Pass in stored token / aura item for use in schema
// TODO Pass in stored token / aura item for current values
// TODO Pass in ID of Aura for field context

static defineSchema() {
return {
Expand Down Expand Up @@ -64,7 +65,7 @@ export class AuraRing extends foundry.abstract.DataModel {
Form.dataFieldOptions(
'Direction (degrees)',
0,
'From the top of the token, where 0 is "forward". The Aura Ring will rotate with the token.',
'From the top of the token where 0 is "forward"; rotates with the token.',
),
Form.dataFieldContext(
'.direction',
Expand Down Expand Up @@ -102,7 +103,6 @@ export class AuraRing extends foundry.abstract.DataModel {
Form.dataFieldOptions(
'Fill Opacity',
0,
'Set to 0 to hide the fill.',
),
Form.dataFieldContext(
'.fill.opacity',
Expand All @@ -123,7 +123,7 @@ export class AuraRing extends foundry.abstract.DataModel {
Form.dataFieldOptions(
'Name',
'Aura', // TODO #
'A unique name for this Aura Ring.',
null,
true,
false,
function () {
Expand All @@ -145,9 +145,9 @@ export class AuraRing extends foundry.abstract.DataModel {
{
return Form.numberField(
Form.dataFieldOptions(
'Radius',
`Radius (${game.scenes.current.grid.units})`,
0,
'How large the Aura Ring is, drawn from the edge of the token. Set to 0 to hide the Aura.',
'Size of the Aura Ring from the edge of the token.',
),
Form.dataFieldContext(
'.radius',
Expand Down Expand Up @@ -199,7 +199,6 @@ export class AuraRing extends foundry.abstract.DataModel {
Form.dataFieldOptions(
'Stroke Opacity',
1,
'Set to 0 to hide the outline.',
),
Form.dataFieldContext(
'.stroke.opacity',
Expand All @@ -220,7 +219,6 @@ export class AuraRing extends foundry.abstract.DataModel {
Form.dataFieldOptions(
'Stroke Weight (pixels)',
4,
'How thick the outline should be.',
),
Form.dataFieldContext(
'.stroke.weight',
Expand All @@ -239,9 +237,9 @@ export class AuraRing extends foundry.abstract.DataModel {
{
return Form.stringField(
Form.dataFieldOptions(
'Visibility',
'Visibile to',
'PLAYER',
'Which roles should be able to see the Aura Ring.',
null,
true,
false,
function () {
Expand Down
104 changes: 0 additions & 104 deletions Config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import { Aura } from "./Aura.js";
import { Form } from "./Form.js";

export class Config
{
form = new Form();

static timeout = 15;

static windowId = 'token-aura-ring-config';

static processChanges(simpleTokenDocument, changes)
Expand Down Expand Up @@ -68,56 +61,6 @@ export class Config
this.resizeConfigForm(button);
}

angle(key, aura)
{
return this.form.group(
'Angle (degrees)',
this.form.range(key, aura, 'angle', 360, 0, 5),
'How much of the circle to draw.',
);
}

colour(key, aura)
{
return this.form.group(
'Colour',
this.form.colour(key, aura, 'colour'),
);
}

configSection(key, aura)
{
const group = document.createElement('div');
group.id = this.form.id(key);

group.append(
this.name(key, aura),
this.radius(key, aura),
this.colour(key, aura),
this.opacity(key, aura),
this.weight(key, aura),
this.visibility(key, aura),
this.direction(key, aura),
this.angle(key, aura),
this.form.break(),
);

return group;
}

configTab()
{
const icon = this.form.icon('fa-ring');
const text = document.createTextNode('Aura Ring');

const link = document.createElement('a');
link.classList.add('item');
link.setAttribute('data-tab', Aura.namespace);
link.append(icon, text);

return link;
}

configWindow(simpleTokenDocument)
{
const configWindow = document.createElement('div');
Expand All @@ -140,15 +83,6 @@ export class Config
return configWindow;
}

direction(key, aura)
{
return this.form.group(
'Direction (degrees)',
this.form.range(key, aura, 'direction', 180, -180, 5),
'From the top of a token, where 0 is "forward". The aura will rotate with the token.',
);
}

markDelete(input)
{
input.value = "yes";
Expand Down Expand Up @@ -177,28 +111,6 @@ export class Config
);
}

opacity(key, aura)
{
return this.form.group(
'Opacity',
this.form.range(key, aura, 'opacity'),
);
}

radius(key, aura)
{
return this.form.group(
'Radius (' + game.scenes.current.grid.units + ')',
this.form.number(key, aura, 'radius'),
);
}

resizeConfigForm(input)
{
const configForm = input.form.parentElement.parentElement;
configForm.style.height = 'auto';
}

show(config)
{
config.position.width = 580;
Expand All @@ -220,20 +132,4 @@ export class Config
content.lastElementChild,
);
}

visibility(key, aura)
{
return this.form.group(
'Visibility',
this.form.select(key, aura, 'visibility', Object.values(CONST.USER_ROLE_NAMES)),
);
}

weight(key, aura)
{
return this.form.group(
'Weight (px)',
this.form.range(key, aura, 'weight', 16, 1, 1),
);
}
}
127 changes: 0 additions & 127 deletions OldForm.js

This file was deleted.

12 changes: 5 additions & 7 deletions Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Settings extends FormApplication
resizable: true,
template: `modules/token-aura-ring/settings.html`,
title: 'Token Aura Ring settings', // TODO Actor name
width: 720,
width: 640,
});
}

Expand All @@ -46,12 +46,8 @@ export class Settings extends FormApplication

static addSettingsButtonToConfig(config)
{
console.log(config);
const settings = new Settings(config);
// Testing
settings.render(true);

/*

const icon = document.createElement('i');
icon.classList.add('fas', 'fa-ring');

Expand All @@ -68,6 +64,8 @@ export class Settings extends FormApplication
formGroup.append(button);

config.form.children[2].appendChild(formGroup);
*/

// TODO Remove after testing
settings.render(true);
}
}
2 changes: 0 additions & 2 deletions aura-ring.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ Hooks.on('initializeVisionSources', Aura.setup);

// TODO "Close" outline toggle
// TODO Rotating to the right breaks angle?
// TODO Add button to Token config
// TODO Link auras to token / save / update
// TODO Preview changes
// TODO Remove old files
// TODO Delete dialogue
// TODO Duplicate dialogue w/name
// TODO Store Aura settings on Actor?
Loading

0 comments on commit 4f3f7a9

Please sign in to comment.