Merge pull request 'Optmi behavior list style' (#31) from dev-mrkbear into master
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build was killed

Reviewed-on: http://git.mrkbear.com/MrKBear/living-together/pulls/31
This commit is contained in:
MrKBear 2022-03-31 22:15:46 +08:00
commit 7fbbcff965
4 changed files with 111 additions and 96 deletions

View File

@ -9,93 +9,106 @@ div.behavior-list {
div.behavior-item { div.behavior-item {
margin: 5px; margin: 5px;
height: $behavior-item-height; height: 45px;
user-select: none; user-select: none;
border-radius: 3px; border-radius: 3px;
overflow: hidden;
cursor: pointer; cursor: pointer;
display: flex;
div.behavior-color-view { div.behavior-color-view {
height: $behavior-item-height; height: 0;
width: 3px; width: 100%;
min-width: 3px;
border-radius: 3px;
flex-shrink: 0;
}
div.behavior-icon-view { div {
height: $behavior-item-height; // position: relative;
min-width: $behavior-item-height; // top: 5px;
width: $behavior-item-height; // left: 5px;
user-select: none; width: 0;
display: flex; height: 0;
justify-content: center; // border-left: 8px solid red;
align-items: center; border-bottom: 12px solid transparent;
// border-radius: 8px;
}
}
i { div.behavior-item-root {
font-size: 25px; display: flex;
}
}
div.behavior-content-view { div.behavior-icon-view {
width: calc( 100% - 68px ); height: $behavior-item-height;
max-width: 100px; min-width: $behavior-item-height;
height: $behavior-item-height; width: $behavior-item-height;
display: flex; user-select: none;
justify-content: center; display: flex;
flex-direction: column; justify-content: center;
align-items: stretch; align-items: center;
div.title-view { i {
white-space: nowrap; font-size: 25px;
text-overflow: ellipsis; }
overflow: hidden; }
width: 100%;
}
div.info-view { div.behavior-content-view {
white-space: nowrap; width: calc( 100% - 50px );
text-overflow: ellipsis; padding-right: 5px;
overflow: hidden; max-width: 125px;
width: 100%; height: $behavior-item-height;
opacity: .75; display: flex;
} justify-content: center;
} flex-direction: column;
align-items: stretch;
div.behavior-action-view { div.title-view {
height: $behavior-item-height; white-space: nowrap;
min-width: 20px; text-overflow: ellipsis;
width: 20px; overflow: hidden;
flex-shrink: 0; width: 100%;
display: flex; }
flex-direction: column;
justify-content: center;
align-content: center;
align-items: center;
div.behavior-action-button { div.info-view {
height: 100%; white-space: nowrap;
width: 100%; text-overflow: ellipsis;
display: flex; overflow: hidden;
justify-content: center; width: 100%;
align-items: center; opacity: .75;
user-select: none; }
cursor: pointer; }
}
div.behavior-action-button.hover-red:hover i { div.behavior-action-view {
color: $lt-red; height: $behavior-item-height;
} min-width: 20px;
width: 20px;
flex-shrink: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
align-items: center;
div.behavior-action-button.hover-blue:hover i { div.behavior-action-button {
color: $lt-blue; height: 100%;
} width: 100%;
} display: flex;
justify-content: center;
align-items: center;
user-select: none;
cursor: pointer;
}
div.behavior-action-button.hover-red:hover i {
color: $lt-red;
}
div.behavior-action-button.hover-blue:hover i {
color: $lt-blue;
}
}
}
} }
div.add-button { div.add-button {
width: 45px; width: 26px;
height: 45px; height: 26px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;

View File

@ -88,6 +88,7 @@ class BehaviorList extends Component<IBehaviorListProps & IMixinSettingProps> {
name = behavior.name; name = behavior.name;
color = behavior.color; color = behavior.color;
needLocal = false; needLocal = false;
info = behavior.behaviorName;
} }
if (behavior instanceof BehaviorRecorder) { if (behavior instanceof BehaviorRecorder) {
@ -111,20 +112,21 @@ class BehaviorList extends Component<IBehaviorListProps & IMixinSettingProps> {
this.isActionClick = false; this.isActionClick = false;
}} }}
> >
<div <div className="behavior-color-view">
className="behavior-color-view" <div style={{ borderLeft: `12px solid ${color}` }}/>
style={{ backgroundColor: color }} </div>
/> <div className="behavior-item-root">
<div className="behavior-icon-view"> <div className="behavior-icon-view">
<Icon iconName={icon}/> <Icon iconName={icon}/>
</div> </div>
<div className="behavior-content-view"> <div className="behavior-content-view">
{this.renderTerm(behavior, name, "title-view", needLocal)} {this.renderTerm(behavior, name, "title-view", needLocal)}
{this.renderTerm(behavior, info, "info-view", true)} {this.renderTerm(behavior, info, "info-view", true)}
</div> </div>
<div className="behavior-action-view"> {/* <div className="behavior-action-view">
{this.renderActionButton(behavior)} {this.renderActionButton(behavior)}
</div> </div> */}
</div>
</div> </div>
} }

View File

@ -69,13 +69,13 @@ class Actuator extends Emitter<IActuatorEvent> {
// 丢帧判定 // 丢帧判定
if (durTime > 0.1) { if (durTime > 0.1) {
console.log("Actuator: Ticker dur time error. dropping...") console.log("Actuator: Ticker dur time error. dropping...")
} } else {
this.alignTimer += durTime;
this.alignTimer += durTime; if (this.alignTimer > (1 / this.fps)) {
if (this.alignTimer > (1 / this.fps)) { this.model.update(this.alignTimer * this.speed);
this.model.update(this.alignTimer * this.speed); this.emit("loop", this.alignTimer);
this.emit("loop", this.alignTimer); this.alignTimer = 0;
this.alignTimer = 0; }
} }
} }
} else { } else {

View File

@ -56,11 +56,11 @@ class SimulatorWeb extends Component {
this.status.newLabel().name = "New Label"; this.status.newLabel().name = "New Label";
this.status.newLabel().name = "Test Label 01"; this.status.newLabel().name = "Test Label 01";
let dynamic = this.status.model.addBehavior(AllBehaviors[0]); let dynamic = this.status.model.addBehavior(AllBehaviors[0]);
dynamic.name = "dynamic"; dynamic.name = "Dynamic"; dynamic.color = "rgb(250, 200, 80)";
let brownian = this.status.model.addBehavior(AllBehaviors[1]); let brownian = this.status.model.addBehavior(AllBehaviors[1]);
brownian.name = "brownian"; brownian.name = "Brownian"; brownian.color = "rgb(200, 80, 250)";
let boundary = this.status.model.addBehavior(AllBehaviors[2]); let boundary = this.status.model.addBehavior(AllBehaviors[2]);
boundary.name = "boundary"; boundary.name = "Boundary"; boundary.color = "rgb(80, 200, 250)";
boundary.parameter.range = this.status.model.allRangeLabel; boundary.parameter.range = this.status.model.allRangeLabel;
group.addBehavior(dynamic); group.addBehavior(dynamic);
group.addBehavior(brownian); group.addBehavior(brownian);