diff --git a/sim/visuals/board.ts b/sim/visuals/board.ts index d7feca8d..9a88ad41 100644 --- a/sim/visuals/board.ts +++ b/sim/visuals/board.ts @@ -466,7 +466,7 @@ namespace pxsim.visuals { const isSelected = EV3View.isPreviousInputSelected(index, node.id) || view.getSelected(); if (isSelected && !view.getSelected()) view.setSelected(true); 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); view.updateState(); if (control) control.updateState(); diff --git a/sim/visuals/controls/closeIcon.ts b/sim/visuals/controls/closeIcon.ts index f16b1650..4f0a47fa 100644 --- a/sim/visuals/controls/closeIcon.ts +++ b/sim/visuals/controls/closeIcon.ts @@ -17,7 +17,6 @@ namespace pxsim.visuals { return this.closeGroup; } - buildDom(): SVGElement { this.content = svg.elt("svg", { width: "100%", height: "100%"}) as SVGSVGElement; this.content.appendChild(this.getInnerView()); diff --git a/sim/visuals/nodes/colorSensorView.ts b/sim/visuals/nodes/colorSensorView.ts index a8d605db..de0d938d 100644 --- a/sim/visuals/nodes/colorSensorView.ts +++ b/sim/visuals/nodes/colorSensorView.ts @@ -1,7 +1,7 @@ -/// +/// namespace pxsim.visuals { - export class ColorSensorView extends ModuleView implements LayoutElement { + export class ColorSensorView extends SensorView implements LayoutElement { private control: ColorGridControl; diff --git a/sim/visuals/nodes/gyroSensorView.ts b/sim/visuals/nodes/gyroSensorView.ts index 193b0d31..0f830f47 100644 --- a/sim/visuals/nodes/gyroSensorView.ts +++ b/sim/visuals/nodes/gyroSensorView.ts @@ -1,7 +1,7 @@ -/// +/// namespace pxsim.visuals { - export class GyroSensorView extends ModuleView implements LayoutElement { + export class GyroSensorView extends SensorView implements LayoutElement { constructor(port: number) { super(GYRO_SVG, "gyro", NodeType.GyroSensor, port); diff --git a/sim/visuals/nodes/infraredview.ts b/sim/visuals/nodes/infraredview.ts index 50ffcd51..3ed41f13 100644 --- a/sim/visuals/nodes/infraredview.ts +++ b/sim/visuals/nodes/infraredview.ts @@ -1,7 +1,7 @@ /// namespace pxsim.visuals { - export class InfraredView extends ModuleView implements LayoutElement { + export class InfraredView extends SensorView implements LayoutElement { constructor(port: number) { super(INFRARED_SVG, "infrared", NodeType.InfraredSensor, port); diff --git a/sim/visuals/nodes/sensorView.ts b/sim/visuals/nodes/sensorView.ts new file mode 100644 index 00000000..e60cd077 --- /dev/null +++ b/sim/visuals/nodes/sensorView.ts @@ -0,0 +1,19 @@ +/// + +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; + } + } +} \ No newline at end of file diff --git a/sim/visuals/nodes/ultrasonicView.ts b/sim/visuals/nodes/ultrasonicView.ts index 5ae9565b..b3a90cb8 100644 --- a/sim/visuals/nodes/ultrasonicView.ts +++ b/sim/visuals/nodes/ultrasonicView.ts @@ -1,7 +1,7 @@ -/// +/// namespace pxsim.visuals { - export class UltrasonicSensorView extends ModuleView implements LayoutElement { + export class UltrasonicSensorView extends SensorView implements LayoutElement { constructor(port: number) { super(ULTRASONIC_SVG, "ultrasonic", NodeType.UltrasonicSensor, port); diff --git a/sim/visuals/view.ts b/sim/visuals/view.ts index e9d0dca3..031a5498 100644 --- a/sim/visuals/view.ts +++ b/sim/visuals/view.ts @@ -212,6 +212,10 @@ namespace pxsim.visuals { } } + public hasClose() { + return true; + } + protected setChangedState() { this.changed = true; } diff --git a/theme/blockly-toolbox.less b/theme/blockly-toolbox.less index a32caea8..e43ec9a3 100644 --- a/theme/blockly-toolbox.less +++ b/theme/blockly-toolbox.less @@ -58,6 +58,11 @@ span.blocklyTreeLabel { border: 1px solid #ebebeb !important; } +/* Monaco flyout */ +.monacoFlyout { + border: 0 !important; +} + /* Mobile */ @media only screen and (max-width: @largestMobileScreen) { #blocklyTrashIcon {