Medium motor resizing (#472)
This commit is contained in:
parent
ac1380ec92
commit
b8286ab0b9
@ -13,7 +13,11 @@ namespace pxsim.visuals {
|
||||
}
|
||||
|
||||
public getPaddingRatio() {
|
||||
return 1 / 5;
|
||||
return 1 / 8;
|
||||
}
|
||||
|
||||
getWiringRatio() {
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
protected renderMotorAngle(holeEl: Element, angle: number) {
|
||||
|
@ -75,7 +75,7 @@ namespace pxsim.visuals {
|
||||
return 0;
|
||||
}
|
||||
if (!this.content.hasAttribute("viewBox")) {
|
||||
return parseFloat(this.content.getAttribute("height"));
|
||||
return this.getContentHeight();
|
||||
}
|
||||
return parseFloat(this.content.getAttribute("viewBox").split(" ")[3]);
|
||||
}
|
||||
@ -85,11 +85,25 @@ namespace pxsim.visuals {
|
||||
return 0;
|
||||
}
|
||||
if (!this.content.hasAttribute("viewBox")) {
|
||||
return parseFloat(this.content.getAttribute("width"));
|
||||
return this.getContentWidth();
|
||||
}
|
||||
return parseFloat(this.content.getAttribute("viewBox").split(" ")[2]);
|
||||
}
|
||||
|
||||
public getContentHeight() {
|
||||
if (!this.content) {
|
||||
return 0;
|
||||
}
|
||||
return parseFloat(this.content.getAttribute("height"));
|
||||
}
|
||||
|
||||
public getContentWidth() {
|
||||
if (!this.content) {
|
||||
return 0;
|
||||
}
|
||||
return parseFloat(this.content.getAttribute("width"));
|
||||
}
|
||||
|
||||
public attachEvents() {
|
||||
}
|
||||
|
||||
@ -98,7 +112,7 @@ namespace pxsim.visuals {
|
||||
this.updateDimensions(width, height);
|
||||
}
|
||||
|
||||
private updateDimensions(width: number, height: number) {
|
||||
protected updateDimensions(width: number, height: number) {
|
||||
if (this.content) {
|
||||
const currentWidth = this.getInnerWidth();
|
||||
const currentHeight = this.getInnerHeight();
|
||||
|
Loading…
Reference in New Issue
Block a user