Skip to content

Commit

Permalink
feat: 新增标尺
Browse files Browse the repository at this point in the history
  • Loading branch information
yaolunmao committed Apr 23, 2023
1 parent 75e6487 commit f3952c4
Show file tree
Hide file tree
Showing 10 changed files with 526 additions and 13 deletions.
491 changes: 491 additions & 0 deletions src/components/vue3-ruler-tool/index.vue

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
outline: 1px solid rgb(23, 222, 30);
}
.contextMenu {
position: absolute;
position: fixed;
z-index: 99999;
background: #ffffff;
padding: 5px 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<el-form-item label="网格" size="small">
<el-switch v-model="configStore.svg.grid"></el-switch>
</el-form-item>
<el-form-item label="标尺" size="small">
<el-switch v-model="configStore.svg.ruler"></el-switch>
</el-form-item>
<!-- 基础版不做画布缩放了 有需要自己写吧(^-^)! -->
<!-- <el-form-item label="缩放" size="small">
<el-input-number
Expand Down
19 changes: 18 additions & 1 deletion src/components/webtopo-svg-edit/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@
</el-aside>
<el-main class="middle main">
<div class="canvas-main-pc">
<center-panel></center-panel>
<vue3-ruler-tool
class="canvas-main-pc"
:value="presetLine"
:step-length="50"
:parent="true"
:is-scale-revise="false"
v-model:visible="configStore.svg.ruler"
@input="input"
>
<center-panel></center-panel>
</vue3-ruler-tool>
</div>
</el-main>
<el-aside class="side-nav" :class="svgEditLayoutStore.right_nav ? 'show-nav' : 'hide-nav'">
Expand Down Expand Up @@ -87,6 +97,8 @@
import { useGlobalStore } from '@/store/global';
import { IDoneJson } from '@/store/global/types';
import 'animate.css';
import { useConfigStore } from '@/store/config';
import vue3RulerTool from '@/components/vue3-ruler-tool/index.vue';
const props = defineProps({
customToolBar: {
type: Object as PropType<IConfigCenter>,
Expand All @@ -97,8 +109,13 @@
default: ''
}
});
const presetLine = ref([]);
const input = (list: any) => {
presetLine.value = list;
};
const globalStore = useGlobalStore();
const svgEditLayoutStore = useSvgEditLayoutStore();
const configStore = useConfigStore();
const importJsonRef = ref<InstanceType<typeof ImportJson>>();
const visible_conf: IVisibleConf = reactive({
[EVisibleConfKey.ExportJson]: false,
Expand Down
4 changes: 2 additions & 2 deletions src/components/webtopo-svg-preview/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
background_color: '#fff',
scale: 1,
position_center: {
x: -315,
y: -95
x: -333,
y: -113
},
svg_position_center: {
x: 50,
Expand Down
7 changes: 4 additions & 3 deletions src/store/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ export const useConfigStore = defineStore('config-store', {
background_color: '#fff',
scale: 1,
position_center: {
x: -315,
y: -95
x: -333,
y: -113
},
svg_position_center: {
x: 50,
y: 50
},
grid: true
grid: true,
ruler: true
}
};
},
Expand Down
1 change: 1 addition & 0 deletions src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export interface IPositionCenterSvg {
y: number;
};
grid: boolean;
ruler: boolean;
}
4 changes: 2 additions & 2 deletions src/views/demo/edit-load.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
background_color: '#fff',
scale: 1,
position_center: {
x: -315,
y: -95
x: -333,
y: -113
},
svg_position_center: {
x: 50,
Expand Down
4 changes: 2 additions & 2 deletions src/views/demo/preview-test.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
background_color: '#fff',
scale: 1,
position_center: {
x: -315,
y: -95
x: -333,
y: -113
},
svg_position_center: {
x: 50,
Expand Down
4 changes: 2 additions & 2 deletions src/views/demo/set-node-attr.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
background_color: '#fff',
scale: 1,
position_center: {
x: -315,
y: -95
x: -333,
y: -113
},
svg_position_center: {
x: 50,
Expand Down

0 comments on commit f3952c4

Please sign in to comment.