A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix: update padding editor to match vec editor style system
esenginec61fd4893da4
diff --git a/editor/src/property/editors/vectorEditors.ts b/editor/src/property/editors/vectorEditors.tsindex a791c4281..aa5895747 100644--- a/editor/src/property/editors/vectorEditors.ts+++ b/editor/src/property/editors/vectorEditors.ts@@ -252,10 +252,11 @@ export function createPaddingEditor(ctx: PropertyEditorContext): PropertyEditorInstance {const wrapper = document.createElement('div');- wrapper.className = 'vec-editor';+ wrapper.className = 'es-vec-editor es-padding-editor';const keys: (keyof PaddingValue)[] = ['left', 'top', 'right', 'bottom'];const labels = ['L', 'T', 'R', 'B'];+ const colorClasses = ['es-pad-l', 'es-pad-t', 'es-pad-r', 'es-pad-b'];let currentPad: PaddingValue = { left: 0, top: 0, right: 0, bottom: 0 };const inputs: HTMLInputElement[] = [];@@ -265,25 +266,29 @@ export function createPaddingEditor(keys.forEach((key, i) => {const group = document.createElement('div');- group.className = 'vec-component';+ group.className = `es-vec-field ${colorClasses[i]}`;+const label = document.createElement('span');- label.className = 'vec-label';+ label.className = 'es-vec-label';label.textContent = labels[i];+const input = document.createElement('input');input.type = 'number';- input.className = 'property-input vec-input';+ input.className = 'es-input es-input-number';+ input.step = '1';input.value = String(currentPad[key]);- input.addEventListener('change', () => {+ const handleChange = () => {currentPad = { ...currentPad, [key]: parseFloat(input.value) || 0 };onChange(currentPad);- });+ };++ input.addEventListener('change', handleChange);input.addEventListener('keydown', (e) => {if (e.key === 'Enter') {input.blur();- currentPad = { ...currentPad, [key]: parseFloat(input.value) || 0 };- onChange(currentPad);+ handleChange();}});diff --git a/editor/src/styles/base.css b/editor/src/styles/base.cssindex 60caa926f..752429352 100644--- a/editor/src/styles/base.css+++ b/editor/src/styles/base.css@@ -540,6 +540,28 @@background: var(--es-bg-tertiary);}+.es-padding-editor {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 2px;+}++.es-vec-field.es-pad-l .es-vec-label {+ background: hsl(200, 50%, 45%);+}++.es-vec-field.es-pad-t .es-vec-label {+ background: hsl(140, 40%, 45%);+}++.es-vec-field.es-pad-r .es-vec-label {+ background: hsl(30, 60%, 50%);+}++.es-vec-field.es-pad-b .es-vec-label {+ background: hsl(340, 50%, 50%);+}+/* =============================================================================* Vec2 Array Editor* ============================================================================= */