|
@@ -75,8 +75,37 @@ class PropsEditor extends Component {
|
|
var e = new Element('<select field="${p.name}"></select>').appendTo(parent);
|
|
var e = new Element('<select field="${p.name}"></select>').appendTo(parent);
|
|
case PFile(exts):
|
|
case PFile(exts):
|
|
new Element('<input type="texturepath" extensions="${exts.join(" ")}" field="${p.name}">').appendTo(parent);
|
|
new Element('<input type="texturepath" extensions="${exts.join(" ")}" field="${p.name}">').appendTo(parent);
|
|
|
|
+ case PString(len):
|
|
|
|
+ var e = new Element('<input type="text" field="${p.name}">').appendTo(parent);
|
|
|
|
+ if ( len != null ) e.attr("maxlength", "" + len);
|
|
|
|
+ if ( p.def != null ) e.attr("value", "" + p.def);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static function makeGroupEl(name: String, content: Element) {
|
|
|
|
+ var el = new Element('<div class="group" name="${name}"></div>');
|
|
|
|
+ content.appendTo(el);
|
|
|
|
+ return el;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static function makeSectionEl(name: String, content: Element, ?headerContent: Element) {
|
|
|
|
+ var el = new Element('<div class="section"><h1><span>${name}</span></h1><div class="content"></div></div>');
|
|
|
|
+ if (headerContent != null) headerContent.appendTo(el.find("h1"));
|
|
|
|
+ content.appendTo(el.find(".content"));
|
|
|
|
+ return el;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static function makeLabelEl(name: String, content: Element) {
|
|
|
|
+ var el = new Element('<dt>${name}</dt><dd></dd>');
|
|
|
|
+ content.appendTo(el.find("dd"));
|
|
|
|
+ return el;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static function makeListEl(content:Array<Element>) {
|
|
|
|
+ var el = new Element("<dl>");
|
|
|
|
+ for ( e in content ) e.appendTo(el);
|
|
|
|
+ return el;
|
|
|
|
+ }
|
|
|
|
|
|
static function upperCase(prop: String) {
|
|
static function upperCase(prop: String) {
|
|
return prop.charAt(0).toUpperCase() + prop.substr(1);
|
|
return prop.charAt(0).toUpperCase() + prop.substr(1);
|
|
@@ -125,6 +154,10 @@ class PropsEditor extends Component {
|
|
section.children(".content").slideToggle(100);
|
|
section.children(".content").slideToggle(100);
|
|
saveDisplayState("section:" + StringTools.trim(e.getThis().text()), section.hasClass("open"));
|
|
saveDisplayState("section:" + StringTools.trim(e.getThis().text()), section.hasClass("open"));
|
|
}).find("input").mousedown(function(e) e.stopPropagation());
|
|
}).find("input").mousedown(function(e) e.stopPropagation());
|
|
|
|
+
|
|
|
|
+ e.find("input[type=section_name]").change(function(e) {
|
|
|
|
+ e.getThis().closest(".section").find(">h1 span").text(e.getThis().val());
|
|
|
|
+ });
|
|
|
|
|
|
// init groups
|
|
// init groups
|
|
var gindex = 0;
|
|
var gindex = 0;
|
|
@@ -157,6 +190,10 @@ class PropsEditor extends Component {
|
|
saveDisplayState("group:" + key, group.hasClass("open"));
|
|
saveDisplayState("group:" + key, group.hasClass("open"));
|
|
|
|
|
|
}).find("input").mousedown(function(e) e.stopPropagation());
|
|
}).find("input").mousedown(function(e) e.stopPropagation());
|
|
|
|
+
|
|
|
|
+ e.find("input[type=group_name]").change(function(e) {
|
|
|
|
+ e.getThis().closest(".group").find(">.title").val(e.getThis().val());
|
|
|
|
+ });
|
|
|
|
|
|
// init input reflection
|
|
// init input reflection
|
|
for( f in e.find("[field]").elements() ) {
|
|
for( f in e.find("[field]").elements() ) {
|