@tscircuit/core 0.0.264 → 0.0.265
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -781,37 +781,44 @@ var PrimitiveComponent = class extends Renderable {
|
|
|
781
781
|
_getSchematicSymbolName() {
|
|
782
782
|
const { _parsedProps: props } = this;
|
|
783
783
|
const base_symbol_name = this.config.schematicSymbolName;
|
|
784
|
+
let normalizedRotation = props.schRotation;
|
|
785
|
+
if (normalizedRotation === void 0) {
|
|
786
|
+
normalizedRotation = 0;
|
|
787
|
+
}
|
|
788
|
+
normalizedRotation = normalizedRotation % 360;
|
|
789
|
+
if (normalizedRotation < 0) {
|
|
790
|
+
normalizedRotation += 360;
|
|
791
|
+
}
|
|
792
|
+
if (props.schRotation !== void 0 && normalizedRotation % 90 !== 0) {
|
|
793
|
+
throw new Error(
|
|
794
|
+
`Schematic rotation ${props.schRotation} is not supported for ${this.componentName}`
|
|
795
|
+
);
|
|
796
|
+
}
|
|
784
797
|
const symbol_name_horz = `${base_symbol_name}_horz`;
|
|
785
798
|
const symbol_name_vert = `${base_symbol_name}_vert`;
|
|
786
799
|
const symbol_name_up = `${base_symbol_name}_up`;
|
|
787
800
|
const symbol_name_down = `${base_symbol_name}_down`;
|
|
788
801
|
const symbol_name_left = `${base_symbol_name}_left`;
|
|
789
802
|
const symbol_name_right = `${base_symbol_name}_right`;
|
|
790
|
-
if (
|
|
791
|
-
throw new Error(
|
|
792
|
-
`Schematic rotation ${props.schRotation} is not supported for ${this.componentName}`
|
|
793
|
-
);
|
|
794
|
-
}
|
|
795
|
-
if (symbol_name_right in symbols && (props.schRotation === void 0 || props.schRotation === 0)) {
|
|
803
|
+
if (symbol_name_right in symbols && normalizedRotation === 0) {
|
|
796
804
|
return symbol_name_right;
|
|
797
805
|
}
|
|
798
|
-
if (symbol_name_up in symbols &&
|
|
806
|
+
if (symbol_name_up in symbols && normalizedRotation === 90) {
|
|
799
807
|
return symbol_name_up;
|
|
800
808
|
}
|
|
801
|
-
if (symbol_name_left in symbols &&
|
|
809
|
+
if (symbol_name_left in symbols && normalizedRotation === 180) {
|
|
802
810
|
return symbol_name_left;
|
|
803
811
|
}
|
|
804
|
-
if (symbol_name_down in symbols &&
|
|
812
|
+
if (symbol_name_down in symbols && normalizedRotation === 270) {
|
|
805
813
|
return symbol_name_down;
|
|
806
814
|
}
|
|
807
815
|
if (symbol_name_horz in symbols) {
|
|
808
|
-
if (
|
|
809
|
-
|
|
810
|
-
if (props.schRotation === 180) return symbol_name_horz;
|
|
816
|
+
if (normalizedRotation === 0) return symbol_name_horz;
|
|
817
|
+
if (normalizedRotation === 180) return symbol_name_horz;
|
|
811
818
|
}
|
|
812
819
|
if (symbol_name_vert in symbols) {
|
|
813
|
-
if (
|
|
814
|
-
if (
|
|
820
|
+
if (normalizedRotation === 90) return symbol_name_vert;
|
|
821
|
+
if (normalizedRotation === 270) return symbol_name_vert;
|
|
815
822
|
}
|
|
816
823
|
if (base_symbol_name in symbols) return base_symbol_name;
|
|
817
824
|
return void 0;
|