pxt-ev3/sim/visuals/nodes/mediumMotorView.ts

26 lines
848 B
TypeScript
Raw Normal View History

/// <reference path="./moduleView.ts" />
2017-12-18 22:04:17 +01:00
namespace pxsim.visuals {
export class MediumMotorView extends MotorView implements LayoutElement {
2017-12-18 22:04:17 +01:00
constructor(port: number) {
super(MEDIUM_MOTOR_SVG, "medium-motor", NodeType.MediumMotor, port, "medmotor_Hole");
2017-12-18 22:04:17 +01:00
}
protected optimizeForLightMode() {
(this.content.getElementById(this.normalizeId('medmotor_box_wgradient')) as SVGElement).style.fill = '#a8aaa8';
}
2017-12-18 22:04:17 +01:00
public getPaddingRatio() {
return 1 / 5;
2017-12-18 22:04:17 +01:00
}
protected renderMotorAngle(holeEl: Element, angle: number) {
const width = 44.45;
const height = 44.45;
const transform = `translate(2 1.84) rotate(${angle} ${width / 2} ${height / 2})`;
2017-12-18 22:04:17 +01:00
holeEl.setAttribute("transform", transform);
}
}
}