@worm-vue3-print/canvas 1.1.0 → 1.2.1
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 +76 -17
- package/dist/canvas.css +1 -1
- package/dist/components/CanvasArea.vue.d.ts +16 -4
- package/dist/components/CanvasPaper.vue.d.ts +0 -3
- package/dist/components/DesignerToolbar.vue.d.ts +11 -1
- package/dist/components/HelpButton.vue.d.ts +7 -0
- package/dist/components/HelpModal.vue.d.ts +15 -0
- package/dist/components/PrintDesigner.vue.d.ts +2 -0
- package/dist/components/Ruler.vue.d.ts +11 -2
- package/dist/composables/useDesignerState.d.ts +1 -0
- package/dist/help-content/changelog.d.ts +6 -0
- package/dist/help-content/faq.d.ts +6 -0
- package/dist/help-content/features.d.ts +6 -0
- package/dist/help-content/getting-started.d.ts +6 -0
- package/dist/help-content/index.d.ts +7 -0
- package/dist/help-content/shortcuts.d.ts +6 -0
- package/dist/index.cjs +427 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4226 -3496
- package/dist/index.js.map +1 -1
- package/dist/utils/ruler.d.ts +24 -2
- package/dist/utils/scale.d.ts +14 -1
- package/dist/utils/units.d.ts +2 -0
- package/package.json +1 -1
package/dist/utils/ruler.d.ts
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
|
+
/** 视口固定尺条厚度(px),CanvasArea 布局与左上角块共用 */
|
|
2
|
+
export declare const RULER_THICKNESS = 22;
|
|
1
3
|
export interface RulerTick {
|
|
4
|
+
/** 刻度在纸面坐标系上的位置(mm,可为负,表示纸张原点之外) */
|
|
2
5
|
mm: number;
|
|
6
|
+
/** 是否为主刻度(带数字标签) */
|
|
3
7
|
major: boolean;
|
|
4
8
|
label?: string;
|
|
5
9
|
}
|
|
6
|
-
/**
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* 按缩放选择主刻度步长(mm):取漂亮数序列中使屏幕间距
|
|
12
|
+
* 不小于 targetPx 的最小步长,保证任意缩放下标签不重叠
|
|
13
|
+
* @param scale 画布缩放比例(1 = 100%)
|
|
14
|
+
* @param targetPx 主刻度之间的目标屏幕间距(px)
|
|
15
|
+
*/
|
|
16
|
+
export declare function chooseMajorStepMM(scale: number, targetPx?: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* 次刻度步长:5 系(5/50/500…)五等分、2 系(2/20/200…)二等分、
|
|
19
|
+
* 10 的幂从 10mm 起五等分(10→2mm、100→20mm),1mm 时无次刻度
|
|
20
|
+
*/
|
|
21
|
+
export declare function minorStepMM(majorStepMM: number): number | null;
|
|
22
|
+
/**
|
|
23
|
+
* 生成可见毫米范围内的全部刻度(升序):
|
|
24
|
+
* 从首个对齐的次刻度开始,主刻度带数字标签
|
|
25
|
+
* @param startMM 可见范围起点(纸面坐标,可为负)
|
|
26
|
+
* @param endMM 可见范围终点
|
|
27
|
+
* @param majorStepMM 主刻度步长(由 chooseMajorStepMM 选出)
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildRulerTicks(startMM: number, endMM: number, majorStepMM: number): RulerTick[];
|
package/dist/utils/scale.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** 最小缩放百分比,低于此值画布难以查看与操作;放大方向不设上限 */
|
|
2
|
+
export declare const MIN_SCALE_PERCENT = 25;
|
|
3
|
+
/** 适应窗口时允许的最小缩放百分比(可低于交互缩放下限,保证超大纸张也能整版容纳) */
|
|
4
|
+
export declare const FIT_SCALE_MIN_PERCENT = 5;
|
|
5
|
+
/** 将缩放百分比钳制到允许范围:仅保留下限,放大不设上限 */
|
|
6
|
+
export declare function clampScalePercent(percent: number): number;
|
|
7
|
+
/**
|
|
8
|
+
* 滚轮缩放:乘性步进(默认 ×1.1 / ÷1.1),大倍数下仍保持平滑手感,
|
|
9
|
+
* 返回取整后的百分比,避免浮点累加产生脏显示(如 110.00000001)
|
|
10
|
+
* @param percent 当前缩放百分比
|
|
11
|
+
* @param direction 1 放大,-1 缩小
|
|
12
|
+
*/
|
|
13
|
+
export declare function nextWheelScale(percent: number, direction: 1 | -1, factor?: number): number;
|
|
14
|
+
/** 计算适应窗口的缩放百分比,允许小于交互缩放下限,保证整版纸张可见 */
|
|
2
15
|
export declare function computeFitScale(containerW: number, containerH: number, paperW: number, paperH: number, ratio?: number): number;
|
package/dist/utils/units.d.ts
CHANGED