Skip to content

Commit c578ad5

Browse files
committed
ADD json style to project panel
1 parent 4b7d9f2 commit c578ad5

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

app/assets/tpl/editProject.html

+4-5
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,14 @@ <h2>
116116
</dd>
117117

118118
<dt>
119-
<label for="minify">Minify JSON</label>
119+
<label for="jsonStyle">JSON indent style</label>
120120
<info>
121-
Enable this to save project JSON file without any "pretty" formatting (ie. white spaces and indentation).
122-
This is NOT necessarily recommended if your project is stored on a versioning system (git, svn etc.) because this could cause issues with diffs and merging operations.
123-
Only use this option if you really need to reduce the project files size.
121+
You can adjust the way the JSON file is formated by LDtk (ie. white spaces and indentation).
122+
Only use Minified if you really need to reduce the project files size. This will cause issues with diffs and merging operations.
124123
</info>
125124
</dt>
126125
<dd>
127-
<input type="checkbox" name="minify" id="minify"/>
126+
<select id="jsonStyle"></select>
128127
</dd>
129128

130129
<dt>

src/electron.renderer/ui/modal/panel/EditProject.hx

+22-6
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,29 @@ class EditProject extends ui.modal.Panel {
208208
jForms.find(".backupRecommend").css("visibility", project.recommendsBackup() ? "visible" : "hidden");
209209

210210

211-
// Json minifiying
212-
var i = Input.linkToHtmlInput( project.minifyJson, jForms.find("[name=minify]") );
211+
// Json style
212+
var jSelect = jForms.find("select#jsonStyle");
213+
var i = new form.input.EnumSelect(
214+
jSelect,
215+
ldtk.Json.JsonStyle,
216+
()->project.jsonStyle,
217+
(v)->{
218+
project.jsonStyle = v;
219+
},
220+
(v)->switch v {
221+
case Minified: L.t._("MINIFIED (minimal file size, no indentation)");
222+
case Compact: L.t._("COMPACT (mostly indented, but small arrays are inlined)");
223+
case Full: L.t._("FULL (fully indented)");
224+
}
225+
);
213226
i.linkEvent(ProjectSettingsChanged);
214-
i.onChange = ()->{
215-
editor.invalidateAllLevelsCache;
216-
recommendSaving();
217-
}
227+
// Json minifiying
228+
// var i = Input.linkToHtmlInput( project.minifyJson, jForms.find("[name=minify]") );
229+
// i.linkEvent(ProjectSettingsChanged);
230+
// i.onChange = ()->{
231+
// editor.invalidateAllLevelsCache;
232+
// recommendSaving();
233+
// }
218234

219235
// Simplified format
220236
var i = Input.linkToHtmlInput( project.simplifiedExport, jForms.find("[name=simplifiedExport]") );

0 commit comments

Comments
 (0)