mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-02-01 16:08:17 +00:00
状态ui。
This commit is contained in:
parent
aed6643e39
commit
eb1fce8847
@ -352,6 +352,28 @@ function Menubar(app) {
|
||||
_this.dom.add(menu);
|
||||
});
|
||||
|
||||
// 状态菜单
|
||||
var statusMenu = new UI2.Panel({
|
||||
id: 'mStatus',
|
||||
cls: 'menu right'
|
||||
});
|
||||
|
||||
var autosave = new UI2.Boolean({
|
||||
text: '自动保存',
|
||||
value: this.app.editor.config.getKey('autosave'),
|
||||
style: 'color: #888 !important;'
|
||||
});
|
||||
statusMenu.add(autosave);
|
||||
|
||||
var version = new UI2.Text({
|
||||
text: 'r' + THREE.REVISION,
|
||||
cls: 'title',
|
||||
style: 'opacity: 0.5'
|
||||
});
|
||||
statusMenu.add(version);
|
||||
|
||||
this.dom.add(statusMenu);
|
||||
|
||||
this.dom.render();
|
||||
};
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import Control from './Control';
|
||||
import Span from './Span';
|
||||
import Checkbox from './Checkbox';
|
||||
import Text from './Text';
|
||||
|
||||
var ID = -1;
|
||||
|
||||
/**
|
||||
* 布尔值
|
||||
@ -10,26 +9,40 @@ import Text from './Text';
|
||||
function Boolean(options) {
|
||||
Control.call(this, options);
|
||||
options = options || {};
|
||||
this.id = options.ID || 'Boolean' + ID--;
|
||||
this.text = options.text || 'Boolean';
|
||||
this.value = options.value || false;
|
||||
};
|
||||
|
||||
Boolean.prototype = Object.create(Control.prototype);
|
||||
Boolean.prototype.constructor = Boolean;
|
||||
|
||||
Boolean.prototype.render = function () {
|
||||
// this.setMarginRight('10px');
|
||||
this.dom = document.createElement('span');
|
||||
this.dom.id = this.id;
|
||||
this.dom.style.marginRight = '10px';
|
||||
this.parent.appendChild(this.dom);
|
||||
|
||||
this.checkbox = new Checkbox(boolean);
|
||||
this.text = new Text(text).setMarginLeft('3px');
|
||||
this.parent.appendChild(this.checkbox);
|
||||
this.parent.appendChild(this.text);
|
||||
this.input = document.createElement('input');
|
||||
this.input.type = 'checkbox';
|
||||
this.input.className = 'Checkbox';
|
||||
this.dom.appendChild(this.input);
|
||||
|
||||
this.span = document.createElement('span');
|
||||
this.span.className = 'Text';
|
||||
this.span.style = 'cursor: default; display: inline-block; vertical-align: middle; margin-left: 3px; color: rgb(136, 136, 136);';
|
||||
this.span.innerHTML = this.text;
|
||||
this.dom.appendChild(this.span);
|
||||
|
||||
this.setValue(this.value);
|
||||
};
|
||||
|
||||
Boolean.prototype.getValue = function () {
|
||||
return this.checkbox.getValue();
|
||||
return this.input.checked;
|
||||
};
|
||||
|
||||
Boolean.prototype.setValue = function (value) {
|
||||
return this.checkbox.setValue(value);
|
||||
this.input.checked = value;
|
||||
};
|
||||
|
||||
export default Boolean;
|
||||
@ -1,5 +1,7 @@
|
||||
import Control from './Control';
|
||||
|
||||
var ID = -1;
|
||||
|
||||
/**
|
||||
* 文本框
|
||||
* @param {*} options
|
||||
@ -7,7 +9,10 @@ import Control from './Control';
|
||||
function Text(options) {
|
||||
Control.call(this, options);
|
||||
options = options || {};
|
||||
this.id = options.id || 'Text' + ID--;
|
||||
this.text = options.text || 'Text';
|
||||
this.cls = options.cls || 'Text';
|
||||
this.style = options.style || null;
|
||||
};
|
||||
|
||||
Text.prototype = Object.create(Control.prototype);
|
||||
@ -15,7 +20,10 @@ Text.prototype.constructor = Text;
|
||||
|
||||
Text.prototype.render = function () {
|
||||
this.dom = document.createElement('span');
|
||||
this.dom.className = 'Text';
|
||||
this.dom.className = this.cls;
|
||||
if (this.style) {
|
||||
this.dom.style = this.style;
|
||||
}
|
||||
this.dom.style.cursor = 'default';
|
||||
this.dom.style.display = 'inline-block';
|
||||
this.dom.style.verticalAlign = 'middle';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user