@fieldnotes/core 0.37.0 → 0.38.0
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/README.md +675 -656
- package/dist/index.cjs +27 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6120,6 +6120,32 @@ var Viewport = class {
|
|
|
6120
6120
|
this.requestRender();
|
|
6121
6121
|
return el.id;
|
|
6122
6122
|
}
|
|
6123
|
+
addShape(opts = {}) {
|
|
6124
|
+
const size = opts.size ?? { w: 100, h: 100 };
|
|
6125
|
+
const position = opts.position ?? this.centeredPosition(size);
|
|
6126
|
+
const shape = createShape({
|
|
6127
|
+
position,
|
|
6128
|
+
size,
|
|
6129
|
+
shape: opts.shape,
|
|
6130
|
+
strokeColor: opts.strokeColor,
|
|
6131
|
+
strokeWidth: opts.strokeWidth,
|
|
6132
|
+
fillColor: opts.fillColor,
|
|
6133
|
+
layerId: this.layerManager.activeLayerId
|
|
6134
|
+
});
|
|
6135
|
+
this.historyRecorder.begin();
|
|
6136
|
+
this.store.add(shape);
|
|
6137
|
+
this.historyRecorder.commit();
|
|
6138
|
+
this.getSelectTool()?.setSelection([shape.id]);
|
|
6139
|
+
this.requestRender();
|
|
6140
|
+
return shape.id;
|
|
6141
|
+
}
|
|
6142
|
+
centeredPosition(size) {
|
|
6143
|
+
const c = this.camera.screenToWorld({
|
|
6144
|
+
x: this.wrapper.clientWidth / 2,
|
|
6145
|
+
y: this.wrapper.clientHeight / 2
|
|
6146
|
+
});
|
|
6147
|
+
return { x: c.x - size.w / 2, y: c.y - size.h / 2 };
|
|
6148
|
+
}
|
|
6123
6149
|
removeLayer(id) {
|
|
6124
6150
|
this.historyRecorder.begin();
|
|
6125
6151
|
this.layerManager.removeLayer(id);
|
|
@@ -8921,7 +8947,7 @@ var TemplateTool = class {
|
|
|
8921
8947
|
};
|
|
8922
8948
|
|
|
8923
8949
|
// src/index.ts
|
|
8924
|
-
var VERSION = "0.
|
|
8950
|
+
var VERSION = "0.38.0";
|
|
8925
8951
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8926
8952
|
0 && (module.exports = {
|
|
8927
8953
|
ArrowTool,
|