增加预览页介绍信息显示
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
#include <QElapsedTimer>
|
||||
#include <QTimer>
|
||||
|
||||
class QKeyEvent;
|
||||
|
||||
class EditorCanvas final : public QWidget {
|
||||
Q_OBJECT
|
||||
@@ -51,6 +54,8 @@ public:
|
||||
// 预览呈现:完整背景 + 全部实体(忽略显隐开关),隐藏编辑辅助元素,仅可平移/缩放查看
|
||||
void setPresentationPreviewMode(bool on);
|
||||
bool presentationPreviewMode() const { return m_presentationPreviewMode; }
|
||||
/// 退出「点击实体放大」状态并平滑回到进入前的视图(预览模式)
|
||||
void clearPresentationEntityFocus();
|
||||
|
||||
void setEntities(const QVector<core::Project::Entity>& entities, const QString& projectDirAbs);
|
||||
void setCurrentFrame(int frame);
|
||||
@@ -79,6 +84,10 @@ signals:
|
||||
void requestMoveEntity(const QString& id, const QPointF& delta);
|
||||
void entityDragActiveChanged(bool on);
|
||||
void selectedEntityPreviewChanged(const QString& id, int depth, const QPointF& originWorld);
|
||||
/// 预览模式下点击实体:anchorView 为实体质心在视图中的位置,用于摆放介绍浮层
|
||||
void presentationEntityIntroRequested(const QString& entityId, QPointF anchorViewPoint);
|
||||
/// 预览模式下应关闭介绍层(空白处轻点、Esc、开始还原缩放时由画布侧触发)
|
||||
void presentationInteractionDismissed();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* e) override;
|
||||
@@ -87,6 +96,7 @@ protected:
|
||||
void mouseMoveEvent(QMouseEvent* e) override;
|
||||
void mouseReleaseEvent(QMouseEvent* e) override;
|
||||
void wheelEvent(QWheelEvent* e) override;
|
||||
void keyPressEvent(QKeyEvent* e) override;
|
||||
|
||||
private:
|
||||
void ensurePixmapLoaded() const;
|
||||
@@ -97,6 +107,12 @@ private:
|
||||
QPointF worldToView(const QPointF& w) const;
|
||||
QRectF worldRectOfBackground() const;
|
||||
|
||||
void tickPresentationZoomAnimation();
|
||||
void tickPresentationHoverAnimation();
|
||||
void beginPresentationZoomTowardEntity(int entityIndex);
|
||||
void beginPresentationZoomRestore();
|
||||
void presentationComputeZoomTarget(int entityIndex, QPointF* outPan, qreal* outScale) const;
|
||||
|
||||
private:
|
||||
struct Entity {
|
||||
QString id;
|
||||
@@ -112,6 +128,7 @@ private:
|
||||
QPointF imageTopLeft; // image 对应的 world 左上角
|
||||
double visualScale = 1.0; // 实体在 world 坐标下的缩放(用于贴图绘制)
|
||||
double userScale = 1.0; // 与深度距离缩放相乘
|
||||
double distanceScaleCalibMult = 0.0; // 与 Project::Entity 一致;0=未校准
|
||||
QPointF animatedOriginWorld;
|
||||
double animatedDepthScale01 = 0.5;
|
||||
// 编辑模式下实体被设为隐藏时:不响应点选且不绘制,除非当前选中(便于树选隐藏实体)
|
||||
@@ -175,5 +192,22 @@ private:
|
||||
QVector<QPointF> m_strokeWorld;
|
||||
|
||||
int m_currentFrame = 0;
|
||||
|
||||
// —— 预览展示:实体悬停动效、点击聚焦缩放 ——
|
||||
QTimer* m_presZoomTimer = nullptr;
|
||||
QTimer* m_presHoverTimer = nullptr;
|
||||
int m_presHoverEntityIndex = -1;
|
||||
int m_presFocusedEntityIndex = -1;
|
||||
qreal m_presHoverPhase = 0.0;
|
||||
QPointF m_presRestorePan;
|
||||
qreal m_presRestoreScale = 1.0;
|
||||
QPointF m_presZoomFromPan;
|
||||
QPointF m_presZoomToPan;
|
||||
qreal m_presZoomFromScale = 1.0;
|
||||
qreal m_presZoomToScale = 1.0;
|
||||
qreal m_presZoomAnimT = 0.0;
|
||||
bool m_presZoomFinishingRestore = false;
|
||||
bool m_presBgPanSession = false;
|
||||
qreal m_presBgDragDist = 0.0;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user