remove feature unhide new geometry by timeline

This commit is contained in:
taDuc
2026-05-24 15:25:37 +07:00
parent 0ebf8e1c65
commit a98e1ac5b0
7 changed files with 6545 additions and 17 deletions
+2 -2
View File
@@ -98,7 +98,7 @@ Nguồn: `const editor = useEditorState(initialData)`
- `editor.hasPersistedFeature(id)` - `editor.hasPersistedFeature(id)`
- `true` nếu feature đã tồn tại trong baseline map nội bộ. - `true` nếu feature đã tồn tại trong baseline map nội bộ.
- Dùng cho timeline filter: feature mới tạo trong session vẫn luôn visible. - Dùng để phân biệt geometry mới khi build snapshot và hiển thị trạng thái `new`.
### 2.2 Snapshot stores (persisted on commit) ### 2.2 Snapshot stores (persisted on commit)
@@ -240,7 +240,7 @@ Search GEO gọi:
Khi bấm **Import** một geometry từ kết quả search: Khi bấm **Import** một geometry từ kết quả search:
1. Tắt `timelineFilterEnabled` để geometry luôn nhìn thấy (không bị filter theo năm). 1. Giữ nguyên `timelineFilterEnabled`; geometry import vẫn tuân theo filter năm hiện tại.
2. Add entity tương ứng vào: 2. Add entity tương ứng vào:
- `snapshotEntities` (source:"ref", operation:"reference") - `snapshotEntities` (source:"ref", operation:"reference")
- `entityCatalog` (để UI có name/description) - `entityCatalog` (để UI có name/description)
+1 -9
View File
@@ -535,7 +535,6 @@ function EditorPageContent() {
// Render draft is the only FeatureCollection that decides what appears on the map. // Render draft is the only FeatureCollection that decides what appears on the map.
// It may be timeline-filtered, replay-filtered, or preview-filtered, but it is not the edit source. // It may be timeline-filtered, replay-filtered, or preview-filtered, but it is not the edit source.
// New features created in the current session remain visible regardless of time range.
const mapRenderDraft = useMemo(() => { const mapRenderDraft = useMemo(() => {
const activeDraft = isReplayPreviewMode const activeDraft = isReplayPreviewMode
? replayPreviewDraft ? replayPreviewDraft
@@ -547,10 +546,7 @@ function EditorPageContent() {
const year = clampYearToFixedRange(Math.trunc(activeTimelineYear)); const year = clampYearToFixedRange(Math.trunc(activeTimelineYear));
return { return {
...activeDraft, ...activeDraft,
features: activeDraft.features.filter((feature) => { features: activeDraft.features.filter((feature) => isFeatureVisibleAtYear(feature, year)),
if (!editor.hasPersistedFeature(feature.properties.id)) return true;
return isFeatureVisibleAtYear(feature, year);
}),
}; };
}, [ }, [
activeTimelineFilterEnabled, activeTimelineFilterEnabled,
@@ -1769,9 +1765,6 @@ function EditorPageContent() {
const geoId = String(geo?.id || "").trim(); const geoId = String(geo?.id || "").trim();
if (!geoId) return; if (!geoId) return;
// Ensure the geometry stays selectable even if it doesn't match the current timeline year.
setTimelineFilterEnabled(false);
const importedEntity: Entity = { const importedEntity: Entity = {
id: entityItem.entity_id, id: entityItem.entity_id,
name: (entityItem.name || "").trim() || entityItem.entity_id, name: (entityItem.name || "").trim() || entityItem.entity_id,
@@ -1847,7 +1840,6 @@ function EditorPageContent() {
handleAddEntityRefToProject, handleAddEntityRefToProject,
setEntityCatalog, setEntityCatalog,
setSelectedFeatureIds, setSelectedFeatureIds,
setTimelineFilterEnabled,
]); ]);
// Commands thao tác metadata/entity binding cho feature đang chọn. // Commands thao tác metadata/entity binding cho feature đang chọn.
+3 -3
View File
@@ -159,8 +159,8 @@ Khi apply, editor patch trực tiếp `feature.properties` của geometry đang
- Slider + numeric input cùng điều khiển `timelineDraftYear`. - Slider + numeric input cùng điều khiển `timelineDraftYear`.
- Có toggle `filterEnabled`. - Có toggle `filterEnabled`.
- Khi bật filter: - Khi bật filter:
- geometry đã có trong baseline chỉ hiện nếu năm hiện tại nằm trong `[time_start, time_end]` - mọi geometry chỉ hiện nếu năm hiện tại nằm trong `[time_start, time_end]`
- geometry mới tạo trong session vẫn được giữ visible - geometry mới tạo trong session cũng tuân theo filter này
Timeline hiện là filter phía client, không fetch lại dữ liệu project theo năm. Timeline hiện là filter phía client, không fetch lại dữ liệu project theo năm.
@@ -178,7 +178,7 @@ Panel phải có `UnifiedSearchBar` với 3 loại search:
- tìm geometry theo tên entity - tìm geometry theo tên entity
- nút `Import` sẽ import geometry vào draft hiện tại - nút `Import` sẽ import geometry vào draft hiện tại
- đồng thời thêm entity tương ứng vào `snapshotEntityRows` nếu chưa có - đồng thời thêm entity tương ứng vào `snapshotEntityRows` nếu chưa có
- import sẽ tự tắt timeline filter để geometry mới import không bị ẩn - import giữ nguyên timeline filter; geometry mới import có thể bị ẩn nếu ngoài năm hiện tại
## 9. Entity và binding ## 9. Entity và binding
+2 -2
View File
@@ -69,7 +69,7 @@ Một thao tác không cần undo nếu nó chỉ đổi trạng thái xem/đi
| Vẽ line | `add-line` mode | Thêm feature vào `mainDraft` | `create` | Như trên | Mặc định `type: defense_line`, `geometry_preset: line` | | Vẽ line | `add-line` mode | Thêm feature vào `mainDraft` | `create` | Như trên | Mặc định `type: defense_line`, `geometry_preset: line` |
| Vẽ path/route | `add-path` mode | Thêm feature vào `mainDraft` | `create` | Như trên | Mặc định `type: attack_route`, render thêm arrow layer | | Vẽ path/route | `add-path` mode | Thêm feature vào `mainDraft` | `create` | Như trên | Mặc định `type: attack_route`, render thêm arrow layer |
| Vẽ circle | `add-circle` mode | Thêm polygon có `circle_center`, `circle_radius` | `create` | Như trên | Mặc định `type: war`, `geometry_preset: circle-area` | | Vẽ circle | `add-circle` mode | Thêm polygon có `circle_center`, `circle_radius` | `create` | Như trên | Mặc định `type: war`, `geometry_preset: circle-area` |
| Import GEO từ search | Search `geo`, nút import | Thêm feature vào `mainDraft`, thêm entity ref nếu thiếu | `group` gồm `snapshot_entities``create` khi cả hai đổi | `geometries[]` và entity ref | Tắt timeline filter để GEO vừa import không bị ẩn | | Import GEO từ search | Search `geo`, nút import | Thêm feature vào `mainDraft`, thêm entity ref nếu thiếu | `group` gồm `snapshot_entities``create` khi cả hai đổi | `geometries[]` và entity ref | Giữ nguyên timeline filter hiện tại |
| Chọn geometry | Click map/panel | `selectedFeatureIds` | Không | Không | Chỉ là UI state | | Chọn geometry | Click map/panel | `selectedFeatureIds` | Không | Không | Chỉ là UI state |
| Focus geometry từ panel | `GeometryBindingPanel` row click | Selection, `geometryFocusRequest`, có thể kéo timeline draft year về `time_start` | Không | Không | Không đổi dữ liệu commit | | Focus geometry từ panel | `GeometryBindingPanel` row click | Selection, `geometryFocusRequest`, có thể kéo timeline draft year về `time_start` | Không | Không | Không đổi dữ liệu commit |
| Sửa vertex/circle | Map edit engine trong `select` | `feature.geometry` | `update` | `geometries[]` | Không hoạt động trong replay mode | | Sửa vertex/circle | Map edit engine trong `select` | `feature.geometry` | `update` | `geometries[]` | Không hoạt động trong replay mode |
@@ -129,7 +129,7 @@ Một thao tác không cần undo nếu nó chỉ đổi trạng thái xem/đi
| Thao tác | State đổi | Undo | Commit | Ghi chú | | Thao tác | State đổi | Undo | Commit | Ghi chú |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| Đổi timeline year | `timelineDraftYear` | Không | Không | Client-side filter | | Đổi timeline year | `timelineDraftYear` | Không | Không | Client-side filter |
| Bật/tắt timeline filter | `timelineFilterEnabled` | Không | Không | New geometry trong session vẫn visible | | Bật/tắt timeline filter | `timelineFilterEnabled` | Không | Không | Áp dụng cho cả geometry mới trong session |
| Geometry bị timeline lọc | Derived `mapRenderDraft` | Không | Không | Panel hiện `timeline` hoặc `out timeline`; selection/panel metadata vẫn đọc `editor.draft` | | Geometry bị timeline lọc | Derived `mapRenderDraft` | Không | Không | Panel hiện `timeline` hoặc `out timeline`; selection/panel metadata vẫn đọc `editor.draft` |
| Geometry mồ côi | Derived từ `normalizeFeatureEntityIds(feature).length === 0` | Không riêng | Commit/submit bị chặn | Map không đổi màu riêng cho orphan; panel hiện `no entity` | | Geometry mồ côi | Derived từ `normalizeFeatureEntityIds(feature).length === 0` | Không riêng | Commit/submit bị chặn | Map không đổi màu riêng cho orphan; panel hiện `no entity` |
| Thiếu time | Derived từ `time_start/time_end` | Không riêng | Vẫn commit được | Panel hiện `no time` hoặc `partial time` | | Thiếu time | Derived từ `time_start/time_end` | Không riêng | Vẫn commit được | Panel hiện `no time` hoặc `partial time` |
+1 -1
View File
@@ -229,7 +229,7 @@ Nó được cập nhật khi:
- nguồn có thể là `mainDraft`, `replayDraft`, hoặc preview draft tùy mode - nguồn có thể là `mainDraft`, `replayDraft`, hoặc preview draft tùy mode
- đã qua filter timeline nếu `timelineFilterEnabled = true` - đã qua filter timeline nếu `timelineFilterEnabled = true`
- đã qua replay preview hidden ids nếu đang preview - đã qua replay preview hidden ids nếu đang preview
- geometry mới tạo trong session không bị timeline filter ẩn - geometry mới tạo trong session ng bị timeline filter xử lý như geometry baseline
### `labelContextBaseDraft` và `mapLabelContextDraft` ### `labelContextBaseDraft` và `mapLabelContextDraft`
File diff suppressed because it is too large Load Diff