|
@@ -66,6 +66,7 @@ const props = defineProps({
|
|
|
const state = reactive({
|
|
|
loading: true,
|
|
|
radio: 1,
|
|
|
+ radioBackup: 1,
|
|
|
realRadioX: 0.5,
|
|
|
realRadioY: 0.5,
|
|
|
imgPoint: { x: 0, y: 0 },
|
|
@@ -211,8 +212,9 @@ const loadInit = () => {
|
|
|
let config = props.jsonData[i]
|
|
|
let subArr = config.subArr
|
|
|
console.log('ratio', state.radio)
|
|
|
- const lW = imgInstance.width //* state.radio
|
|
|
- const lH = imgInstance.height //* state.radio
|
|
|
+ state.radioBackup = state.radio
|
|
|
+ const lW = imgInstance.width * state.radio
|
|
|
+ const lH = imgInstance.height * state.radio
|
|
|
let obj = new fabric.Path(
|
|
|
'M ' +
|
|
|
subArr[1] * lW +
|
|
@@ -754,7 +756,7 @@ const clearAll = () => {
|
|
|
state.drawType = 'rectangle'
|
|
|
}
|
|
|
const getPoint = pi => {
|
|
|
- return Math.floor(pi / state.radio)
|
|
|
+ return Math.floor(pi)// / state.radio
|
|
|
}
|
|
|
const getRealPoint = poi => {
|
|
|
let dx = Math.abs(state.imgPoint.x > poi.x ? state.imgPoint.x - poi.x : state.imgPoint.x + poi.x) * state.realRadioX
|
|
@@ -807,8 +809,9 @@ const getData = () => {
|
|
|
// console.log(poi)
|
|
|
poi = getRealPoint(poi)
|
|
|
// console.log(poi)
|
|
|
- poi.x = poi.x / 1920
|
|
|
- poi.y = poi.y / 1080
|
|
|
+ console.log('radio final:', state.radio, state.radioBackup)
|
|
|
+ poi.x = poi.x / 1920 / state.radioBackup
|
|
|
+ poi.y = poi.y / 1080 / state.radioBackup
|
|
|
// console.log(poi)
|
|
|
point['nodes'].push(poi)
|
|
|
// point['nodes'].push(getRealPoint(poi))
|