mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-21 01:13:37 +08:00
Merge branch 'patch' into next
This commit is contained in:
commit
fc9534c7d1
@ -62,6 +62,7 @@ class Menu {
|
||||
this.onClose = this.options.onClose;
|
||||
}
|
||||
hover(node, event, expand) {
|
||||
if (node.classList.contains('focused')) return;
|
||||
if (event) event.stopPropagation()
|
||||
$(open_menu.node).find('li.focused').removeClass('focused')
|
||||
$(open_menu.node).find('li.opened').removeClass('opened')
|
||||
|
@ -510,8 +510,7 @@ new Property(ModelProject, 'array', 'timeline_setups', {
|
||||
condition: () => Format.animation_mode,
|
||||
});
|
||||
new Property(ModelProject, 'object', 'unhandled_root_fields', {
|
||||
exposed: false,
|
||||
default: {}
|
||||
exposed: false
|
||||
});
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@ class Property {
|
||||
case 'number': this.default = 0; break;
|
||||
case 'boolean': this.default = false; break;
|
||||
case 'array': this.default = []; break;
|
||||
case 'object': this.default = {}; break;
|
||||
case 'instance': this.default = null; break;
|
||||
case 'vector': this.default = [0, 0, 0]; break;
|
||||
case 'vector2': this.default = [0, 0]; break;
|
||||
@ -31,6 +32,7 @@ class Property {
|
||||
case 'number': this.isNumber = true; break;
|
||||
case 'boolean': this.isBoolean = true; break;
|
||||
case 'array': this.isArray = true; break;
|
||||
case 'object': this.isObject = true; break;
|
||||
case 'instance': this.isInstance = true; break;
|
||||
case 'vector': this.isVector = true; break;
|
||||
case 'vector2': this.isVector2 = true; break;
|
||||
@ -68,6 +70,10 @@ class Property {
|
||||
getDefault(instance) {
|
||||
if (typeof this.default == 'function') {
|
||||
return this.default(instance);
|
||||
} else if (this.isArray) {
|
||||
return this.default.slice();
|
||||
} else if (this.isObject) {
|
||||
return Object.keys(this.default).length ? JSON.parse(JSON.stringify(this.default)) : {};
|
||||
} else {
|
||||
return this.default;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user