forked from mirror/ObjToSchematic
Added support for resizing the sidebar
This commit is contained in:
parent
f5a33746a1
commit
49fb86e991
13
package-lock.json
generated
13
package-lock.json
generated
@ -8,6 +8,9 @@
|
|||||||
"name": "objtoschematic",
|
"name": "objtoschematic",
|
||||||
"version": "0.7.4",
|
"version": "0.7.4",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"split.js": "^1.6.5"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/adm-zip": "^0.5.0",
|
"@types/adm-zip": "^0.5.0",
|
||||||
"@types/jest": "^27.4.1",
|
"@types/jest": "^27.4.1",
|
||||||
@ -8814,6 +8817,11 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/split.js": {
|
||||||
|
"version": "1.6.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/split.js/-/split.js-1.6.5.tgz",
|
||||||
|
"integrity": "sha512-mPTnGCiS/RiuTNsVhCm9De9cCAUsrNFFviRbADdKiiV+Kk8HKp/0fWu7Kr8pi3/yBmsqLFHuXGT9UUZ+CNLwFw=="
|
||||||
|
},
|
||||||
"node_modules/stack-trace": {
|
"node_modules/stack-trace": {
|
||||||
"version": "0.0.10",
|
"version": "0.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
||||||
@ -17270,6 +17278,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"split.js": {
|
||||||
|
"version": "1.6.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/split.js/-/split.js-1.6.5.tgz",
|
||||||
|
"integrity": "sha512-mPTnGCiS/RiuTNsVhCm9De9cCAUsrNFFviRbADdKiiV+Kk8HKp/0fWu7Kr8pi3/yBmsqLFHuXGT9UUZ+CNLwFw=="
|
||||||
|
},
|
||||||
"stack-trace": {
|
"stack-trace": {
|
||||||
"version": "0.0.10",
|
"version": "0.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint --fix src tools tests --ext .ts",
|
"lint": "eslint --fix src tools tests --ext .ts",
|
||||||
|
"lint-src": "eslint --fix src --ext .ts",
|
||||||
"test": "jest --config jestconfig.json",
|
"test": "jest --config jestconfig.json",
|
||||||
"start": "webpack serve --config ./webpack.dev.js",
|
"start": "webpack serve --config ./webpack.dev.js",
|
||||||
"dist": "webpack --config ./webpack.prod.js",
|
"dist": "webpack --config ./webpack.prod.js",
|
||||||
@ -72,5 +73,8 @@
|
|||||||
"webpack-merge": "^5.8.0",
|
"webpack-merge": "^5.8.0",
|
||||||
"webpack-strip-block": "^0.3.0",
|
"webpack-strip-block": "^0.3.0",
|
||||||
"worker-loader": "^3.0.8"
|
"worker-loader": "^3.0.8"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"split.js": "^1.6.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
import { BaseUIElement } from './base_element';
|
|
||||||
import { LabelElement } from './label';
|
|
||||||
|
|
||||||
export abstract class LabelledElement<Type> extends BaseUIElement<Type> {
|
|
||||||
private _label: string;
|
|
||||||
private _labelElement: LabelElement;
|
|
||||||
|
|
||||||
public constructor(label: string) {
|
|
||||||
super();
|
|
||||||
this._label = label;
|
|
||||||
this._labelElement = new LabelElement(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
public generateHTML() {
|
|
||||||
return `
|
|
||||||
${this._labelElement.generateHTML()}
|
|
||||||
<div class="prop-value-container">
|
|
||||||
${this.generateInnerHTML()}
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract generateInnerHTML(): string;
|
|
||||||
|
|
||||||
protected _onEnabledChanged() {
|
|
||||||
this._labelElement.setEnabled(this.getEnabled());
|
|
||||||
}
|
|
||||||
|
|
||||||
public addDescription(text: string) {
|
|
||||||
this._labelElement = new LabelElement(this._label, text);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +1,5 @@
|
|||||||
|
import Split from 'split.js';
|
||||||
|
|
||||||
import { AppContext } from '../app_context';
|
import { AppContext } from '../app_context';
|
||||||
import { FallableBehaviour } from '../block_mesh';
|
import { FallableBehaviour } from '../block_mesh';
|
||||||
import { ArcballCamera } from '../camera';
|
import { ArcballCamera } from '../camera';
|
||||||
@ -7,7 +9,6 @@ import { MeshType, Renderer } from '../renderer';
|
|||||||
import { EAction } from '../util';
|
import { EAction } from '../util';
|
||||||
import { ASSERT } from '../util/error_util';
|
import { ASSERT } from '../util/error_util';
|
||||||
import { LOG } from '../util/log_util';
|
import { LOG } from '../util/log_util';
|
||||||
import { AppPaths } from '../util/path_util';
|
|
||||||
import { TAxis } from '../util/type_util';
|
import { TAxis } from '../util/type_util';
|
||||||
import { TDithering } from '../util/type_util';
|
import { TDithering } from '../util/type_util';
|
||||||
import { TVoxelOverlapRule } from '../voxel_mesh';
|
import { TVoxelOverlapRule } from '../voxel_mesh';
|
||||||
@ -312,7 +313,7 @@ export class UI {
|
|||||||
.isEnabled(() => {
|
.isEnabled(() => {
|
||||||
return Renderer.Get.getModelsAvailable() >= MeshType.VoxelMesh;
|
return Renderer.Get.getModelsAvailable() >= MeshType.VoxelMesh;
|
||||||
}),
|
}),
|
||||||
'blockMesh': new ToolbarItemElement({ id: 'blockMesh', iconSVG: AppIcons.BLOCK })
|
'blockMesh': new ToolbarItemElement({ id: 'blockMesh', iconSVG: AppIcons.BLOCK })
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
Renderer.Get.setModelToUse(MeshType.BlockMesh);
|
Renderer.Get.setModelToUse(MeshType.BlockMesh);
|
||||||
})
|
})
|
||||||
@ -487,6 +488,16 @@ export class UI {
|
|||||||
|
|
||||||
toolbarHTML.placeInto('toolbar');
|
toolbarHTML.placeInto('toolbar');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Split(['.column-properties', '.column-canvas'], {
|
||||||
|
sizes: [20, 80],
|
||||||
|
minSize: [400, 500],
|
||||||
|
});
|
||||||
|
|
||||||
|
const item = document.getElementsByClassName('gutter').item(0);
|
||||||
|
if (item !== null) {
|
||||||
|
item.innerHTML = `<div class='gutter-line'></div>`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public cacheValues(action: EAction) {
|
public cacheValues(action: EAction) {
|
||||||
@ -657,7 +668,7 @@ export class UI {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
textureAtlases.push({ payload: 'vanilla', displayText: 'Vanilla '});
|
textureAtlases.push({ payload: 'vanilla', displayText: 'Vanilla ' });
|
||||||
|
|
||||||
return textureAtlases;
|
return textureAtlases;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import { ASSERT } from './error_util';
|
|||||||
export namespace UIUtil {
|
export namespace UIUtil {
|
||||||
export function getElementById(id: string) {
|
export function getElementById(id: string) {
|
||||||
const element = document.getElementById(id);
|
const element = document.getElementById(id);
|
||||||
//ASSERT(element !== null, `Attempting to getElement of nonexistent element: ${id}`);
|
ASSERT(element !== null, `Attempting to getElement of nonexistent element: ${id}`);
|
||||||
return element as HTMLElement;
|
return element as HTMLElement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
56
styles.css
56
styles.css
@ -1,9 +1,8 @@
|
|||||||
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400&display=swap');
|
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400&display=swap');
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--properties-width: max(400px, 20%);
|
|
||||||
--pill-radius: 5px;
|
--pill-radius: 5px;
|
||||||
--prop-bg: hsl(0, 0%, 10%);
|
--prop-bg: rgb(26, 26, 26);
|
||||||
--prop-alt: hsl(0, 0%, 15%);
|
--prop-alt: hsl(0, 0%, 15%);
|
||||||
|
|
||||||
--prop-accent-border-hovered: #33AAC2;
|
--prop-accent-border-hovered: #33AAC2;
|
||||||
@ -32,32 +31,56 @@
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
background: rgb(25, 25, 25);
|
|
||||||
font-family: 'Lexend', sans-serif;
|
font-family: 'Lexend', sans-serif;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gutter {
|
||||||
|
cursor: col-resize;
|
||||||
|
height: 100%;
|
||||||
|
background: rgb(20, 20, 20);
|
||||||
|
border-left: 1px solid rgb(15, 15, 15);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gutter-line {
|
||||||
|
background-color: hsl(0, 0%, 20%);
|
||||||
|
width: 2px;
|
||||||
|
height: 20%;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.column-properties {
|
.column-properties {
|
||||||
background: var(--prop-bg);
|
background: var(--prop-bg);
|
||||||
position: absolute;
|
|
||||||
width: var(--properties-width);
|
|
||||||
height: 100%;
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.column-canvas {
|
.column-canvas {
|
||||||
position: absolute;
|
|
||||||
margin-left: var(--properties-width);
|
|
||||||
width: calc(100% - var(--properties-width));
|
|
||||||
height: 100%;
|
|
||||||
cursor: crosshair;
|
cursor: crosshair;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,16 +401,16 @@ select:disabled {
|
|||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
::-webkit-scrollbar-track {
|
||||||
background: rgba(0, 0, 0, 0.2);
|
background: rgb(20, 20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
background: rgba(255, 255, 255, 0.1);
|
background: rgb(50, 50, 50);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
::-webkit-scrollbar-thumb:hover {
|
||||||
background: rgba(255, 255, 255, 0.2);
|
background: rgb(60, 60, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-builder-item {
|
.message-builder-item {
|
||||||
@ -457,9 +480,10 @@ select:disabled {
|
|||||||
|
|
||||||
.toolbar {
|
.toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: inherit;
|
position: relative;
|
||||||
flex-direction: row;
|
top: -100vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
cursor: inherit;
|
cursor: inherit;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
@ -2,34 +2,47 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<!-- Google tag (gtag.js) -->
|
<!-- Google tag (gtag.js) -->
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-W0SCWQ7HGJ"></script>
|
<script
|
||||||
|
async
|
||||||
|
src="https://www.googletagmanager.com/gtag/js?id=G-W0SCWQ7HGJ"
|
||||||
|
></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag() {
|
||||||
gtag('js', new Date());
|
dataLayer.push(arguments);
|
||||||
|
}
|
||||||
|
gtag("js", new Date());
|
||||||
|
|
||||||
gtag('config', 'G-W0SCWQ7HGJ');
|
gtag("config", "G-W0SCWQ7HGJ");
|
||||||
</script>
|
</script>
|
||||||
<meta charset="utf8" />
|
<meta charset="utf8" />
|
||||||
<title>ObjToSchematic Web</title>
|
<title>ObjToSchematic Web</title>
|
||||||
<meta
|
<meta
|
||||||
name="description"
|
name="description"
|
||||||
content="A tool to convert 3D models into Minecraft formats such as .schematic, .litematic, .schem and .nbt."
|
content="A tool to convert 3D models into Minecraft formats such as .schematic, .litematic, .schem and .nbt."
|
||||||
/>
|
/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta property="og:title" content="ObjToSchematic" />
|
<meta property="og:title" content="ObjToSchematic" />
|
||||||
<meta property="og:description" content="A tool to convert 3D models into Minecraft formats such as .schematic, .litematic, .schem and .nbt." />
|
<meta
|
||||||
|
property="og:description"
|
||||||
|
content="A tool to convert 3D models into Minecraft formats such as .schematic, .litematic, .schem and .nbt."
|
||||||
|
/>
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:url" content="https://objtoschematic.com/" />
|
<meta property="og:url" content="https://objtoschematic.com/" />
|
||||||
<meta property="og:image" content="https://i.imgur.com/TwdIpyb.png" />
|
<meta property="og:image" content="https://i.imgur.com/TwdIpyb.png" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="column-properties" id="properties"></div>
|
<div class="content">
|
||||||
<div class="column-canvas">
|
<div class="split column-properties" id="properties"></div>
|
||||||
<canvas id="canvas"></canvas>
|
<div class="split column-canvas">
|
||||||
<div class="toolbar" id="toolbar"></div>
|
<canvas id="canvas"></canvas>
|
||||||
|
<div class="toolbar" id="toolbar"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9188679203215896"
|
<script
|
||||||
crossorigin="anonymous"></script>
|
async
|
||||||
|
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9188679203215896"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user