9292QTMImagePopup::showImagePopup (rectangle selr, double magf, int scroll_x,
9393 int scroll_y, int canvas_x) {
9494 cachePosition (selr, magf, scroll_x, scroll_y, canvas_x);
95- if (cached_magf <= 0.16 ) {
96- setFixedSize (0 , 0 );
97- return ;
98- }
9995 hide ();
100- autoSize ();
10196 int x, y;
10297 getCachedPosition (x, y);
10398 QPoint topLeft (x, y);
10499 move (topLeft);
100+ autoSize ();
105101 raise ();
106102 updateButtonStates ();
107103 show ();
@@ -144,7 +140,7 @@ QTMImagePopup::autoSize () {
144140 const int baseHeight= 50 ;
145141 double totalScale= Scale * cached_magf * 3.3 ;
146142#if defined(Q_OS_MAC)
147- const int IconSize= int (50 * Scale );
143+ const int IconSize= int (80 * totalScale );
148144#else
149145 const int IconSize= int (40 * totalScale);
150146#endif
@@ -172,10 +168,16 @@ QTMImagePopup::cachePosition (rectangle selr, double magf, int scroll_x,
172168// 计算菜单显示位置
173169void
174170QTMImagePopup::getCachedPosition (int & x, int & y) {
175- x= ((cached_image_mid_x - cached_scroll_x - 500 ) * cached_magf +
176- cached_canvas_x) /
177- 256 -
178- (this ->width () / 2 );
179- y= -((cached_image_mid_y - 5000 - cached_scroll_y) * cached_magf) / 256 -
180- this ->height () * 1.2 ;
171+ // 坐标转换:TeXmacs坐标 → 屏幕坐标
172+
173+ // x坐标
174+ double image_center_screen_x=
175+ ((cached_image_mid_x - cached_scroll_x) * cached_magf + cached_canvas_x) /
176+ 256.0 ;
177+ x= (int ) (image_center_screen_x - (this ->width () / 2.0 ));
178+
179+ // y坐标
180+ double image_center_screen_y=
181+ -((cached_image_mid_y - cached_scroll_y) * cached_magf) / 256.0 ;
182+ y= (int ) (image_center_screen_y - (this ->height () / 4.0 ));
181183}
0 commit comments