File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -144,12 +144,33 @@ export namespace Camera {
144144 const diffViewVector = Renderer . transformWorld2View ( targetLocationByScale ) ;
145145 dealCameraScale ( ) ;
146146 if ( scaleCameraByMouseLocation ) {
147- setLocationByOtherLocation ( targetLocationByScale , diffViewVector ) ;
147+ if ( tickNumber > tickNumberUpper ) {
148+ setLocationByOtherLocation ( targetLocationByScale , diffViewVector ) ;
149+ }
148150 }
149151 // 循环空间
150152 if ( limitCameraInCycleSpace ) {
151153 dealCycleSpace ( ) ;
152154 }
155+ tickNumber ++ ;
156+ }
157+ /**
158+ * 当前的帧编号
159+ */
160+ let tickNumber = 0 ;
161+ /**
162+ * 多少帧以后,才能继续跟随鼠标缩放
163+ */
164+ let tickNumberUpper = 0 ;
165+
166+ export function zoomInByKeyboard ( ) {
167+ Camera . targetScale *= 1.2 ;
168+ tickNumberUpper = tickNumber + 5 * 60 ;
169+ }
170+
171+ export function zoomOutByKeyboard ( ) {
172+ Camera . targetScale *= 0.8 ;
173+ tickNumberUpper = tickNumber + 5 * 60 ;
153174 }
154175
155176 /**
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ export class Section extends ConnectableEntity {
144144 // 群友需求:希望Section框扩大交互范围,标题也能拖动
145145 const newRect = new Rectangle ( rectangle . location . clone ( ) , new Vector ( rectangle . size . x , 50 ) ) ;
146146 this . _collisionBoxNormal . shapeList . push ( newRect ) ;
147- console . log ( newRect ) ;
147+ // console.log(newRect);
148148 // 调整折叠状态
149149 this . _collisionBoxWhenCollapsed = this . collapsedCollisionBox ( ) ;
150150 }
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ async function registerKeyBinds() {
201201 shift : false ,
202202 } )
203203 ) . down ( ( ) => {
204- Camera . targetScale *= 1.2 ;
204+ Camera . zoomInByKeyboard ( ) ;
205205 } ) ;
206206
207207 (
@@ -211,7 +211,7 @@ async function registerKeyBinds() {
211211 shift : false ,
212212 } )
213213 ) . down ( ( ) => {
214- Camera . targetScale *= 0.8 ;
214+ Camera . zoomOutByKeyboard ( ) ;
215215 } ) ;
216216
217217 (
You can’t perform that action at this time.
0 commit comments