Revize 50044675
Přidáno uživatelem Fantič před více než 1 rok
src/components/plan/CastlePlanView.tsx | ||
---|---|---|
146 | 146 |
|
147 | 147 |
// console.log("x " + event.nativeEvent.locationX + " y " + event.nativeEvent.locationY) |
148 | 148 |
console.log("view size:") |
149 |
console.log("x " + viewSize.width + " y " + viewSize.height) |
|
149 |
console.log("x " + viewSize.width + " y " + viewSize.height) |
|
150 |
|
|
151 |
const viewRatio = viewSize.width / viewSize.height |
|
152 |
console.log("ratio: " + viewSize.width / viewSize.height) |
|
150 | 153 |
console.log("svg size:") |
151 | 154 |
console.log("x " + mapImage.viewBox.width + " y " + mapImage.viewBox.height) |
155 |
const svgRatio = mapImage.viewBox.width / mapImage.viewBox.height |
|
156 |
console.log("ratio: " + mapImage.viewBox.width / mapImage.viewBox.height) |
|
152 | 157 |
|
153 | 158 |
let mapX = (locationX / viewSize.width) * mapImage.viewBox.width |
154 | 159 |
let mapY = (locationY / viewSize.height) * mapImage.viewBox.height |
155 | 160 |
|
161 |
if(svgRatio > viewRatio){ |
|
162 |
// svg is spaced in the middle |
|
163 |
// top down is filled |
|
156 | 164 |
|
157 |
// if() |
|
158 |
|
|
159 | 165 |
|
166 |
// TODO recalculate mapY |
|
167 |
} |
|
168 |
else if(svgRatio < viewRatio){ |
|
169 |
// svg is spaced in the center |
|
170 |
// left right is filled |
|
160 | 171 |
|
172 |
// TODO recalculate mapX |
|
173 |
} |
|
161 | 174 |
|
162 | 175 |
// console.log("x " + mapX + " y " + mapY) |
163 | 176 |
// console.log("") |
Také k dispozici: Unified diff
re #10882: CastlePlanView: Calculate svg/ viewbox ratio