From 99bf424a0f87cedf4832ff7597a6e00dca8572a4 Mon Sep 17 00:00:00 2001 From: liteng <930372551@qq.com> Date: Sun, 9 Sep 2018 14:07:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=98=B4=E5=BD=B1=E5=81=8F?= =?UTF-8?q?=E5=B7=AE=E8=AE=BE=E7=BD=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/component/ShadowComponent.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ShadowEditor.Web/src/component/ShadowComponent.js b/ShadowEditor.Web/src/component/ShadowComponent.js index d32beae2..a2d0e35b 100644 --- a/ShadowEditor.Web/src/component/ShadowComponent.js +++ b/ShadowEditor.Web/src/component/ShadowComponent.js @@ -88,6 +88,21 @@ ShadowComponent.prototype.render = function () { value: 512, onChange: this.onChangeMapSize.bind(this) }] + }, { + xtype: 'row', + id: 'objectBiasRow', + scope: this.id, + children: [{ + xtype: 'label', + text: '偏差' + }, { + xtype: 'number', + id: 'objectBias', + scope: this.id, + value: 0, + range: [0, 1], + onChange: this.onChangeBias.bind(this) + }] }] }; @@ -120,11 +135,13 @@ ShadowComponent.prototype.updateUI = function () { var objectShadowRadiusRow = UI.get('objectShadowRadiusRow', this.id); var objectMapSizeRow = UI.get('objectMapSizeRow', this.id); + var objectBiasRow = UI.get('objectBiasRow', this.id); var objectCastShadow = UI.get('objectCastShadow', this.id); var objectReceiveShadow = UI.get('objectReceiveShadow', this.id); var objectShadowRadius = UI.get('objectShadowRadius', this.id); var objectMapSize = UI.get('objectMapSize', this.id); + var objectBias = UI.get('objectBias', this.id); objectCastShadow.setValue(this.selected.castShadow); @@ -132,13 +149,16 @@ ShadowComponent.prototype.updateUI = function () { objectReceiveShadow.dom.style.display = 'none'; objectShadowRadiusRow.dom.style.display = ''; objectMapSizeRow.dom.style.display = ''; + objectBiasRow.dom.style.display = ''; objectShadowRadius.setValue(this.selected.shadow.radius); var mapSize = this.selected.shadow.mapSize; objectMapSize.setValue(mapSize.x); + objectBias.setValue(this.selected.shadow.bias); } else { objectReceiveShadow.dom.style.display = ''; objectShadowRadiusRow.dom.style.display = 'none'; objectMapSizeRow.dom.style.display = 'none'; + objectBiasRow.dom.style.display = 'none'; objectReceiveShadow.setValue(this.selected.receiveShadow); } }; @@ -180,4 +200,9 @@ ShadowComponent.prototype.onChangeMapSize = function () { this.selected.shadow.mapSize.x = this.selected.shadow.mapSize.y = parseInt(mapSize); }; +ShadowComponent.prototype.onChangeBias = function () { + var objectBias = UI.get('objectBias', this.id); + this.selected.shadow.bias = objectBias.getValue(); +}; + export default ShadowComponent; \ No newline at end of file