remove feature unhide new geometry by timeline
This commit is contained in:
@@ -98,7 +98,7 @@ Nguồn: `const editor = useEditorState(initialData)`
|
||||
|
||||
- `editor.hasPersistedFeature(id)`
|
||||
- `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)
|
||||
|
||||
@@ -240,7 +240,7 @@ Search GEO gọi:
|
||||
|
||||
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:
|
||||
- `snapshotEntities` (source:"ref", operation:"reference")
|
||||
- `entityCatalog` (để UI có name/description)
|
||||
|
||||
@@ -535,7 +535,6 @@ function EditorPageContent() {
|
||||
|
||||
// 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.
|
||||
// New features created in the current session remain visible regardless of time range.
|
||||
const mapRenderDraft = useMemo(() => {
|
||||
const activeDraft = isReplayPreviewMode
|
||||
? replayPreviewDraft
|
||||
@@ -547,10 +546,7 @@ function EditorPageContent() {
|
||||
const year = clampYearToFixedRange(Math.trunc(activeTimelineYear));
|
||||
return {
|
||||
...activeDraft,
|
||||
features: activeDraft.features.filter((feature) => {
|
||||
if (!editor.hasPersistedFeature(feature.properties.id)) return true;
|
||||
return isFeatureVisibleAtYear(feature, year);
|
||||
}),
|
||||
features: activeDraft.features.filter((feature) => isFeatureVisibleAtYear(feature, year)),
|
||||
};
|
||||
}, [
|
||||
activeTimelineFilterEnabled,
|
||||
@@ -1769,9 +1765,6 @@ function EditorPageContent() {
|
||||
const geoId = String(geo?.id || "").trim();
|
||||
if (!geoId) return;
|
||||
|
||||
// Ensure the geometry stays selectable even if it doesn't match the current timeline year.
|
||||
setTimelineFilterEnabled(false);
|
||||
|
||||
const importedEntity: Entity = {
|
||||
id: entityItem.entity_id,
|
||||
name: (entityItem.name || "").trim() || entityItem.entity_id,
|
||||
@@ -1847,7 +1840,6 @@ function EditorPageContent() {
|
||||
handleAddEntityRefToProject,
|
||||
setEntityCatalog,
|
||||
setSelectedFeatureIds,
|
||||
setTimelineFilterEnabled,
|
||||
]);
|
||||
|
||||
// Commands thao tác metadata/entity binding cho feature đang chọn.
|
||||
|
||||
@@ -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`.
|
||||
- Có toggle `filterEnabled`.
|
||||
- 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]`
|
||||
- geometry mới tạo trong session vẫn được giữ visible
|
||||
- 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 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.
|
||||
|
||||
@@ -178,7 +178,7 @@ Panel phải có `UnifiedSearchBar` với 3 loại search:
|
||||
- tìm geometry theo tên entity
|
||||
- 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ó
|
||||
- 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
|
||||
|
||||
|
||||
@@ -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ẽ 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` |
|
||||
| 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` và `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` và `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 |
|
||||
| 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 |
|
||||
@@ -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ú |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Đổ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 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` |
|
||||
|
||||
@@ -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
|
||||
- đã qua filter timeline nếu `timelineFilterEnabled = true`
|
||||
- đã 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 cũng bị timeline filter xử lý như geometry baseline
|
||||
|
||||
### `labelContextBaseDraft` và `mapLabelContextDraft`
|
||||
|
||||
|
||||
+2765
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user