tweaks on number inputs

This commit is contained in:
Vlyan
2020-12-20 16:05:59 +01:00
parent d087ec5080
commit e1105b6293
20 changed files with 170 additions and 73 deletions

View File

@@ -32,9 +32,14 @@ export class ItemSheetL5r5e extends ItemSheet {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
// if (!this.options.editable) {
// return;
// }
if (!this.options.editable) {
return;
}
// On focus on one numeric element, select all text for better experience
html.find(".select-on-focus").on("focus", (event) => {
event.target.select();
});
}
/**
@@ -45,4 +50,37 @@ export class ItemSheetL5r5e extends ItemSheet {
_updateObject(event, formData) {
return this.object.update(formData);
}
/**
* Create drag-and-drop workflow handlers for this Application
* @return An array of DragDrop handlers
*/
_createDragDropHandlers() {
return [
new DragDrop({
dragSelector: ".property",
dropSelector: null,
permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) },
callbacks: { dragstart: this._onDragStart.bind(this), drop: this._onDrop.bind(this) },
}),
];
}
/**
* Handle dropped data on the Item sheet, only "property" allowed.
* Also a property canot be on another property
*/
_onDrop(event) {
// Check item type and subtype
const item = game.l5r5e.HelpersL5r5e.getDragnDropTargetObject(event);
if (!item || item.entity !== "Item" || item.data.type !== "property" || this.item.type === "property") {
return Promise.resolve();
}
// TODO
console.log("Item - _onDrop - ", item, this);
// Ok add item
// return super._onDrop(event);
}
}