Change to always show the sensor controls. (#526)
This commit is contained in:
parent
03add213d9
commit
3c96cfcc0a
@ -466,7 +466,7 @@ namespace pxsim.visuals {
|
|||||||
const isSelected = EV3View.isPreviousInputSelected(index, node.id) || view.getSelected();
|
const isSelected = EV3View.isPreviousInputSelected(index, node.id) || view.getSelected();
|
||||||
if (isSelected && !view.getSelected()) view.setSelected(true);
|
if (isSelected && !view.getSelected()) view.setSelected(true);
|
||||||
const control = isSelected ? this.getControlForNode(node.id, index, !node.modeChange()) : undefined;
|
const control = isSelected ? this.getControlForNode(node.id, index, !node.modeChange()) : undefined;
|
||||||
const closeIcon = control ? this.getCloseIconView() : undefined;
|
const closeIcon = control && view.hasClose() ? this.getCloseIconView() : undefined;
|
||||||
this.layoutView.setInput(index, view, control, closeIcon);
|
this.layoutView.setInput(index, view, control, closeIcon);
|
||||||
view.updateState();
|
view.updateState();
|
||||||
if (control) control.updateState();
|
if (control) control.updateState();
|
||||||
|
@ -17,7 +17,6 @@ namespace pxsim.visuals {
|
|||||||
return this.closeGroup;
|
return this.closeGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buildDom(): SVGElement {
|
buildDom(): SVGElement {
|
||||||
this.content = svg.elt("svg", { width: "100%", height: "100%"}) as SVGSVGElement;
|
this.content = svg.elt("svg", { width: "100%", height: "100%"}) as SVGSVGElement;
|
||||||
this.content.appendChild(this.getInnerView());
|
this.content.appendChild(this.getInnerView());
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/// <reference path="./moduleView.ts" />
|
/// <reference path="./sensorView.ts" />
|
||||||
|
|
||||||
namespace pxsim.visuals {
|
namespace pxsim.visuals {
|
||||||
export class ColorSensorView extends ModuleView implements LayoutElement {
|
export class ColorSensorView extends SensorView implements LayoutElement {
|
||||||
|
|
||||||
private control: ColorGridControl;
|
private control: ColorGridControl;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/// <reference path="./moduleView.ts" />
|
/// <reference path="./sensorView.ts" />
|
||||||
|
|
||||||
namespace pxsim.visuals {
|
namespace pxsim.visuals {
|
||||||
export class GyroSensorView extends ModuleView implements LayoutElement {
|
export class GyroSensorView extends SensorView implements LayoutElement {
|
||||||
|
|
||||||
constructor(port: number) {
|
constructor(port: number) {
|
||||||
super(GYRO_SVG, "gyro", NodeType.GyroSensor, port);
|
super(GYRO_SVG, "gyro", NodeType.GyroSensor, port);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/// <reference path="./moduleView.ts" />
|
/// <reference path="./moduleView.ts" />
|
||||||
|
|
||||||
namespace pxsim.visuals {
|
namespace pxsim.visuals {
|
||||||
export class InfraredView extends ModuleView implements LayoutElement {
|
export class InfraredView extends SensorView implements LayoutElement {
|
||||||
|
|
||||||
constructor(port: number) {
|
constructor(port: number) {
|
||||||
super(INFRARED_SVG, "infrared", NodeType.InfraredSensor, port);
|
super(INFRARED_SVG, "infrared", NodeType.InfraredSensor, port);
|
||||||
|
19
sim/visuals/nodes/sensorView.ts
Normal file
19
sim/visuals/nodes/sensorView.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/// <reference path="./moduleView.ts" />
|
||||||
|
|
||||||
|
namespace pxsim.visuals {
|
||||||
|
|
||||||
|
export abstract class SensorView extends ModuleView implements LayoutElement {
|
||||||
|
|
||||||
|
constructor(xml: string, prefix: string, id: NodeType, port: NodeType) {
|
||||||
|
super(xml, prefix, id, port);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSelected() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public hasClose() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
/// <reference path="./moduleView.ts" />
|
/// <reference path="./sensorView.ts" />
|
||||||
|
|
||||||
namespace pxsim.visuals {
|
namespace pxsim.visuals {
|
||||||
export class UltrasonicSensorView extends ModuleView implements LayoutElement {
|
export class UltrasonicSensorView extends SensorView implements LayoutElement {
|
||||||
|
|
||||||
constructor(port: number) {
|
constructor(port: number) {
|
||||||
super(ULTRASONIC_SVG, "ultrasonic", NodeType.UltrasonicSensor, port);
|
super(ULTRASONIC_SVG, "ultrasonic", NodeType.UltrasonicSensor, port);
|
||||||
|
@ -212,6 +212,10 @@ namespace pxsim.visuals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public hasClose() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected setChangedState() {
|
protected setChangedState() {
|
||||||
this.changed = true;
|
this.changed = true;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,11 @@ span.blocklyTreeLabel {
|
|||||||
border: 1px solid #ebebeb !important;
|
border: 1px solid #ebebeb !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Monaco flyout */
|
||||||
|
.monacoFlyout {
|
||||||
|
border: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Mobile */
|
/* Mobile */
|
||||||
@media only screen and (max-width: @largestMobileScreen) {
|
@media only screen and (max-width: @largestMobileScreen) {
|
||||||
#blocklyTrashIcon {
|
#blocklyTrashIcon {
|
||||||
|
Loading…
Reference in New Issue
Block a user