From b64f85aaa2a1969b556c51cc9cd16b8a1a4840aa Mon Sep 17 00:00:00 2001 From: PopSlime Date: Wed, 15 Mar 2023 15:36:45 +0800 Subject: [PATCH] Add category for expression list in skin editor. --- Http/SkinEditor/app.css | 18 ++++++++++++++++++ Http/SkinEditor/app.js | 33 ++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/Http/SkinEditor/app.css b/Http/SkinEditor/app.css index 4f9e96d..c196682 100644 --- a/Http/SkinEditor/app.css +++ b/Http/SkinEditor/app.css @@ -63,12 +63,26 @@ body { padding: 0 4px; margin: 1px; cursor: pointer; + break-before: avoid; } .t-li:hover { background-color: lightblue; } +.t-li-cat { + padding: 0 4px; + margin: 1px; + border-bottom: solid 1px dimgray; + color: dimgray; + font-size: small; +} + +.t-li-cat-2 { + border-bottom-style: dashed; + font-size: x-small; +} + input { border: none; font-family: sans-serif; @@ -286,6 +300,10 @@ input { .t-li:hover { background-color: darkblue; } + .t-li-cat { + border-bottom-color: lightgray; + color: lightgray; + } input { background-color: black; color: white; diff --git a/Http/SkinEditor/app.js b/Http/SkinEditor/app.js index 01c194d..24bb880 100644 --- a/Http/SkinEditor/app.js +++ b/Http/SkinEditor/app.js @@ -39,7 +39,6 @@ var statementlists = { "statement.comp": ["input.comp"], "statement.define": ["input.ident", "exp"], "statement.exp.cast.vector2number": ["exp.vector"], - "statement.exp.cast.number2vector": ["exp.number"], "statement.exp.const.w": [], "statement.exp.const.h": [], "statement.exp.const.inf": [], @@ -115,14 +114,14 @@ var explists = { ], "exp.number": [ "statement.exp.literal.number", "statement.exp.cast.vector2number", - "statement.exp.const.w", "statement.exp.const.h", "statement.exp.const.inf", "statement.exp.const.true", "statement.exp.const.false", - "statement.exp.op.add", "statement.exp.op.sub", "statement.exp.op.mul", "statement.exp.op.div", "statement.exp.op.mod", - "statement.exp.op.add1", "statement.exp.op.sub1", "statement.exp.op.not", - "statement.exp.op.at", "statement.exp.op.lt", "statement.exp.op.eq", "statement.exp.op.gt", - "statement.exp.func.interval", "statement.exp.func.is", - "statement.exp.func.int", "statement.exp.func.clamp", "statement.exp.func.min", "statement.exp.func.max", "statement.exp.func.abs", - "statement.exp.func.cubic_bezier", "statement.exp.func.ease", "statement.exp.func.ease_in", "statement.exp.func.ease_out", "statement.exp.func.ease_in_out", - "statement.exp.func.attack_timing", "statement.exp.func.enter_timing", "statement.exp.func.release_timing", "statement.exp.func.leave_timing", "statement.exp.func.contact_timing", + "-exp.const", "statement.exp.const.w", "statement.exp.const.h", "statement.exp.const.inf", "statement.exp.const.true", "statement.exp.const.false", + "-exp.op", "statement.exp.op.add", "statement.exp.op.sub", "statement.exp.op.mul", "statement.exp.op.div", "statement.exp.op.mod", + "-", "statement.exp.op.add1", "statement.exp.op.sub1", "statement.exp.op.not", + "-", "statement.exp.op.at", "statement.exp.op.lt", "statement.exp.op.eq", "statement.exp.op.gt", + "-exp.func", "statement.exp.func.interval", "statement.exp.func.is", + "-exp.func.ctx", "statement.exp.func.int", "statement.exp.func.clamp", "statement.exp.func.min", "statement.exp.func.max", "statement.exp.func.abs", + "-exp.func.anim", "statement.exp.func.cubic_bezier", "statement.exp.func.ease", "statement.exp.func.ease_in", "statement.exp.func.ease_out", "statement.exp.func.ease_in_out", + "-exp.func.judge", "statement.exp.func.attack_timing", "statement.exp.func.enter_timing", "statement.exp.func.release_timing", "statement.exp.func.leave_timing", "statement.exp.func.contact_timing", "#exp.any" ], "exp.string": [ @@ -311,16 +310,24 @@ function generateAddExpList(event, item) { event.stopPropagation(); if (clist) clist.remove(); var ul = $("").addClass("t-list t-exp-list"); - (function addExpRecursive(it) { + (function addExpRecursive(it, depth) { + if (depth > 0) { + ul.append($("
  • ").addClass("t-li-cat t-li-cat-" + depth.toString()).text(msg("list.category." + it))); + } var items = explists[it]; for (var i in items) { var item = items[i]; - if (item[0] == "#") - addExpRecursive(item.substring(1)); + if (item[0] == "#") { + if (depth == 0) addExpRecursive(item.substring(1), 1); + } + else if (item == "-") + ul.append($("
  • ").addClass("t-li-br")); + else if (item[0] == "-") + ul.append($("
  • ").addClass("t-li-cat t-li-cat-" + (depth + 1).toString()).text(msg("list.category." + item.substring(1)))); else ul.append($("
  • ").addClass("t-li").attr("key", item).text(msg("list." + item)).on("click", null, item, onAddItemClick)); } - })(item); + })(item, 0); popup(event, ul); }