@tscircuit/core 0.0.263 → 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 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -781,32 +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 (symbol_name_right in symbols &&
|
|
803
|
+
if (symbol_name_right in symbols && normalizedRotation === 0) {
|
|
791
804
|
return symbol_name_right;
|
|
792
805
|
}
|
|
793
|
-
if (symbol_name_up in symbols &&
|
|
806
|
+
if (symbol_name_up in symbols && normalizedRotation === 90) {
|
|
794
807
|
return symbol_name_up;
|
|
795
808
|
}
|
|
796
|
-
if (symbol_name_left in symbols &&
|
|
809
|
+
if (symbol_name_left in symbols && normalizedRotation === 180) {
|
|
797
810
|
return symbol_name_left;
|
|
798
811
|
}
|
|
799
|
-
if (symbol_name_down in symbols &&
|
|
812
|
+
if (symbol_name_down in symbols && normalizedRotation === 270) {
|
|
800
813
|
return symbol_name_down;
|
|
801
814
|
}
|
|
802
815
|
if (symbol_name_horz in symbols) {
|
|
803
|
-
if (
|
|
804
|
-
|
|
805
|
-
if (props.schRotation === 180) return symbol_name_horz;
|
|
816
|
+
if (normalizedRotation === 0) return symbol_name_horz;
|
|
817
|
+
if (normalizedRotation === 180) return symbol_name_horz;
|
|
806
818
|
}
|
|
807
819
|
if (symbol_name_vert in symbols) {
|
|
808
|
-
if (
|
|
809
|
-
if (
|
|
820
|
+
if (normalizedRotation === 90) return symbol_name_vert;
|
|
821
|
+
if (normalizedRotation === 270) return symbol_name_vert;
|
|
810
822
|
}
|
|
811
823
|
if (base_symbol_name in symbols) return base_symbol_name;
|
|
812
824
|
return void 0;
|