schematic-symbols 0.0.93 → 0.0.94
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +44 -7
- package/dist/index.js.map +1 -1
- package/drawing/rotateSymbol.ts +48 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -195,12 +195,46 @@ var ac_voltmeter_horz_default = defineSymbol({
|
|
195
195
|
|
196
196
|
// drawing/rotateSymbol.ts
|
197
197
|
import { rotate, applyToPoint } from "transformation-matrix";
|
198
|
-
var rotateAnchor = (anchor) => {
|
199
|
-
switch (
|
200
|
-
case "
|
201
|
-
|
202
|
-
|
203
|
-
|
198
|
+
var rotateAnchor = (anchor, orientation = "right") => {
|
199
|
+
switch (orientation) {
|
200
|
+
case "up":
|
201
|
+
switch (anchor) {
|
202
|
+
case "middle_top":
|
203
|
+
return "middle_left";
|
204
|
+
case "middle_bottom":
|
205
|
+
return "middle_right";
|
206
|
+
case "middle_left":
|
207
|
+
return "middle_bottom";
|
208
|
+
case "middle_right":
|
209
|
+
return "middle_top";
|
210
|
+
}
|
211
|
+
break;
|
212
|
+
case "down":
|
213
|
+
switch (anchor) {
|
214
|
+
case "middle_top":
|
215
|
+
return "middle_right";
|
216
|
+
case "middle_bottom":
|
217
|
+
return "middle_left";
|
218
|
+
case "middle_left":
|
219
|
+
return "middle_top";
|
220
|
+
case "middle_right":
|
221
|
+
return "middle_bottom";
|
222
|
+
}
|
223
|
+
break;
|
224
|
+
case "left":
|
225
|
+
switch (anchor) {
|
226
|
+
case "middle_top":
|
227
|
+
return "middle_left";
|
228
|
+
case "middle_bottom":
|
229
|
+
return "middle_right";
|
230
|
+
case "middle_left":
|
231
|
+
return "middle_bottom";
|
232
|
+
case "middle_right":
|
233
|
+
return "middle_top";
|
234
|
+
}
|
235
|
+
break;
|
236
|
+
case "right":
|
237
|
+
return anchor;
|
204
238
|
}
|
205
239
|
return anchor;
|
206
240
|
};
|
@@ -232,7 +266,10 @@ var rotateSymbol = (symbol, orientation, overrides) => {
|
|
232
266
|
x: primitive.x,
|
233
267
|
y: primitive.y
|
234
268
|
});
|
235
|
-
primitive.anchor = rotateAnchor(
|
269
|
+
primitive.anchor = rotateAnchor(
|
270
|
+
primitive.anchor,
|
271
|
+
orientation ?? "right"
|
272
|
+
);
|
236
273
|
return {
|
237
274
|
...primitive,
|
238
275
|
x: rotatedPoint.x,
|