fix(earth-controls): zoom-aware drag sensitivity and bump version to 0.22.13
This commit is contained in:
@@ -7,6 +7,27 @@ This project follows the repository versioning rule:
|
|||||||
- `feature` -> `+0.1.0`
|
- `feature` -> `+0.1.0`
|
||||||
- `bugfix` -> `+0.0.1`
|
- `bugfix` -> `+0.0.1`
|
||||||
|
|
||||||
|
## 0.22.13
|
||||||
|
|
||||||
|
Released: 2026-04-07
|
||||||
|
|
||||||
|
### Highlights
|
||||||
|
|
||||||
|
- Added zoom-aware drag sensitivity on Earth interaction so drag distance naturally becomes finer when zoomed in and faster when zoomed out.
|
||||||
|
- Shipped as a focused bugfix release (`+0.0.1`) to improve operation feel without changing existing data/visual layers.
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
|
||||||
|
- Improved [main.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/main.js) by replacing fixed drag rotation gain with a dynamic factor derived from current zoom level.
|
||||||
|
- Improved [main.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/main.js) by introducing `getDragRotationFactor()` so interaction tuning stays centralized instead of mixing formulas in pointer handlers.
|
||||||
|
- Improved [constants.js](/home/ray/dev/linkong/planet/frontend/public/earth/js/constants.js) by adding explicit drag tuning knobs:
|
||||||
|
`dragRotationFactorBase`, `dragRotationScaleMin`, and `dragRotationScaleMax`.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed the previous interaction mismatch where drag traveled the same angular distance regardless of zoom level, making close-up inspection too jumpy and far-view browsing too slow.
|
||||||
|
- Fixed maintainability drift where drag sensitivity had a hardcoded literal in logic code instead of configurable constants.
|
||||||
|
|
||||||
## 0.22.12
|
## 0.22.12
|
||||||
|
|
||||||
Released: 2026-04-02
|
Released: 2026-04-02
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "planet-frontend",
|
"name": "planet-frontend",
|
||||||
"version": "0.22.12",
|
"version": "0.22.13",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/icons": "^5.2.6",
|
"@ant-design/icons": "^5.2.6",
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ export const CONFIG = {
|
|||||||
maxZoom: 5.0,
|
maxZoom: 5.0,
|
||||||
earthRadius: 100,
|
earthRadius: 100,
|
||||||
rotationSpeed: 0.0005,
|
rotationSpeed: 0.0005,
|
||||||
|
dragRotationFactorBase: 0.005,
|
||||||
|
dragRotationScaleMin: 0.28,
|
||||||
|
dragRotationScaleMax: 2.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Earth coordinate constants
|
// Earth coordinate constants
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ import {
|
|||||||
getShowTerrain,
|
getShowTerrain,
|
||||||
setAutoRotate,
|
setAutoRotate,
|
||||||
resetView,
|
resetView,
|
||||||
|
getZoomLevel,
|
||||||
teardownControls,
|
teardownControls,
|
||||||
} from "./controls.js";
|
} from "./controls.js";
|
||||||
import {
|
import {
|
||||||
@@ -170,7 +171,6 @@ const scratchBGPDirection = new THREE.Vector3();
|
|||||||
const scratchBGPWorldPosition = new THREE.Vector3();
|
const scratchBGPWorldPosition = new THREE.Vector3();
|
||||||
|
|
||||||
const cleanupFns = [];
|
const cleanupFns = [];
|
||||||
const DRAG_ROTATION_FACTOR = 0.005;
|
|
||||||
const DRAG_SMOOTHING_FACTOR = 0.18;
|
const DRAG_SMOOTHING_FACTOR = 0.18;
|
||||||
const INERTIA_DAMPING = 0.92;
|
const INERTIA_DAMPING = 0.92;
|
||||||
const INERTIA_MIN_VELOCITY = 0.00008;
|
const INERTIA_MIN_VELOCITY = 0.00008;
|
||||||
@@ -201,6 +201,16 @@ function isEventOnHud(event) {
|
|||||||
return HUD_INTERACTIVE_SELECTORS.some((selector) => target.closest(selector));
|
return HUD_INTERACTIVE_SELECTORS.some((selector) => target.closest(selector));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDragRotationFactor() {
|
||||||
|
const zoom = Math.max(getZoomLevel(), 0.01);
|
||||||
|
const scale = THREE.MathUtils.clamp(
|
||||||
|
1 / zoom,
|
||||||
|
CONFIG.dragRotationScaleMin,
|
||||||
|
CONFIG.dragRotationScaleMax,
|
||||||
|
);
|
||||||
|
return CONFIG.dragRotationFactorBase * scale;
|
||||||
|
}
|
||||||
|
|
||||||
function disposeMaterial(material) {
|
function disposeMaterial(material) {
|
||||||
if (!material) return;
|
if (!material) return;
|
||||||
if (Array.isArray(material)) {
|
if (Array.isArray(material)) {
|
||||||
@@ -1142,8 +1152,9 @@ function onMouseMove(event) {
|
|||||||
|
|
||||||
const deltaX = event.clientX - previousMousePosition.x;
|
const deltaX = event.clientX - previousMousePosition.x;
|
||||||
const deltaY = event.clientY - previousMousePosition.y;
|
const deltaY = event.clientY - previousMousePosition.y;
|
||||||
const rotationDeltaY = deltaX * DRAG_ROTATION_FACTOR;
|
const dragRotationFactor = getDragRotationFactor();
|
||||||
const rotationDeltaX = deltaY * DRAG_ROTATION_FACTOR;
|
const rotationDeltaY = deltaX * dragRotationFactor;
|
||||||
|
const rotationDeltaX = deltaY * dragRotationFactor;
|
||||||
|
|
||||||
targetRotation.y += rotationDeltaY;
|
targetRotation.y += rotationDeltaY;
|
||||||
targetRotation.x += rotationDeltaX;
|
targetRotation.x += rotationDeltaX;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "planet"
|
name = "planet"
|
||||||
version = "0.22.12"
|
version = "0.22.13"
|
||||||
description = "智能星球计划 - 态势感知系统"
|
description = "智能星球计划 - 态势感知系统"
|
||||||
requires-python = ">=3.14"
|
requires-python = ">=3.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
Reference in New Issue
Block a user