Add UV menu

This commit is contained in:
JannisX11 2022-05-07 19:35:41 +02:00
parent 5af58b2eec
commit 7c39a65efa
2 changed files with 13 additions and 1 deletions

View File

@ -47,6 +47,8 @@ class Menu {
this.node = $('<ul class="contextMenu"></ul>')[0]
this.structure = structure;
this.options = options || {};
this.onOpen = this.options.onOpen;
this.onClose = this.options.onClose;
}
hover(node, event, expand) {
if (event) event.stopPropagation()
@ -148,6 +150,7 @@ class Menu {
return used;
}
open(position, context) {
if (this.onOpen) this.onOpen(position, context);
if (position && position.changedTouches) {
convertTouchEvent(position);
@ -439,6 +442,7 @@ class Menu {
return this.open(position);
}
hide() {
if (this.onClose) this.onClose();
$(this.node).find('li.highlighted').removeClass('highlighted');
$(this.node).detach()
open_menu = null;
@ -532,7 +536,7 @@ class Menu {
}
class BarMenu extends Menu {
constructor(id, structure, options = {}) {
super()
super(id, structure, options)
var scope = this;
MenuBar.menus[id] = this
this.type = 'bar_menu'
@ -781,6 +785,13 @@ const MenuBar = {
condition: {modes: ['edit']}
})
new BarMenu('uv', UVEditor.menu.structure, {
condition: {modes: ['edit']},
onOpen() {
setActivePanel('uv');
}
})
new BarMenu('texture', [
'adjust_brightness_contrast',
'adjust_saturation_hue',

View File

@ -1373,6 +1373,7 @@
"menu.file": "File",
"menu.edit": "Edit",
"menu.transform": "Transform",
"menu.uv": "UV",
"menu.texture": "Texture",
"menu.tools": "Tools",
"menu.display": "Display",