mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 15:15:34 +00:00
Differentiate between uneditable and un-highlighted properties in the modifications menu
This commit is contained in:
@@ -72,6 +72,11 @@ export default class Modification extends TranslatedComponent {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let inputClassNames = {
|
||||||
|
'cb': true,
|
||||||
|
'greyed-out': !this.props.highlight
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div onBlur={this._updateFinished.bind(this)} key={name}
|
<div onBlur={this._updateFinished.bind(this)} key={name}
|
||||||
className={cn('cb', 'modification-container')}
|
className={cn('cb', 'modification-container')}
|
||||||
@@ -84,12 +89,12 @@ export default class Modification extends TranslatedComponent {
|
|||||||
<td className={'input-container'}>
|
<td className={'input-container'}>
|
||||||
<span>
|
<span>
|
||||||
{this.props.editable ?
|
{this.props.editable ?
|
||||||
<NumberEditor className={'cb'} value={this.state.value}
|
<NumberEditor className={cn(inputClassNames)} value={this.state.value}
|
||||||
decimals={2} style={{ textAlign: 'right' }} step={0.01}
|
decimals={2} style={{ textAlign: 'right' }} step={0.01}
|
||||||
stepModifier={1} onKeyDown={ this.props.onKeyDown }
|
stepModifier={1} onKeyDown={ this.props.onKeyDown }
|
||||||
onValueChange={this._updateValue.bind(this)} /> :
|
onValueChange={this._updateValue.bind(this)} /> :
|
||||||
<input type="text" value={formats.f2(this.state.value)}
|
<input type="text" value={formats.f2(this.state.value)}
|
||||||
disabled className={'number-editor'}
|
disabled className={cn('number-editor', 'greyed-out')}
|
||||||
style={{ textAlign: 'right', cursor: 'inherit' }}/>
|
style={{ textAlign: 'right', cursor: 'inherit' }}/>
|
||||||
}
|
}
|
||||||
<span className={'unit-container'}>
|
<span className={'unit-container'}>
|
||||||
|
|||||||
@@ -214,11 +214,11 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
for (const modName of Modifications.modules[m.grp].modifications) {
|
for (const modName of Modifications.modules[m.grp].modifications) {
|
||||||
if (!Modifications.modifications[modName].hidden) {
|
if (!Modifications.modifications[modName].hidden) {
|
||||||
const key = modName + (m.getModValue(modName) / 100 || 0);
|
const key = modName + (m.getModValue(modName) / 100 || 0);
|
||||||
const editable = modName !== 'fallofffromrange' &&
|
const editable = modName !== 'fallofffromrange';
|
||||||
m.blueprint.grades[m.blueprint.grade].features[modName];
|
const highlight = m.blueprint.grades[m.blueprint.grade].features[modName];
|
||||||
this.lastNeId = modName;
|
this.lastNeId = modName;
|
||||||
(editable ? modifiableModifications : modifications).push(
|
(editable && highlight ? modifiableModifications : modifications).push(
|
||||||
<Modification key={ key } ship={ ship } m={ m }
|
<Modification key={ key } ship={ ship } m={ m } highlight={highlight}
|
||||||
value={m.getPretty(modName) || 0} modItems={this.modItems}
|
value={m.getPretty(modName) || 0} modItems={this.modItems}
|
||||||
onChange={onChange} onKeyDown={this._keyDown} name={modName}
|
onChange={onChange} onKeyDown={this._keyDown} name={modName}
|
||||||
editable={editable} handleModChange = {this._handleModChange} />
|
editable={editable} handleModChange = {this._handleModChange} />
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
border-color:#fff;
|
border-color:#fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
input:disabled {
|
input.greyed-out {
|
||||||
border-color: #888;
|
border-color: #888;
|
||||||
color: #888;
|
color: #888;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user