File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 254
254
return true
255
255
}
256
256
257
+ /** 宽度,也用于计算拖动时的最小 right */
258
+ const TOC_BAR_WIDTH = 340
259
+
257
260
// ---------------- TocBar ----------------------
258
261
const TOC_BAR_STYLE = `
259
262
.toc-bar {
263
266
z-index: 9000;
264
267
right: 5px;
265
268
top: 80px;
266
- width: 340px ;
269
+ width: ${ TOC_BAR_WIDTH } px ;
267
270
font-size: 14px;
268
271
box-sizing: border-box;
269
272
padding: 0 10px 10px 0;
@@ -525,7 +528,7 @@ a.toc-link {
525
528
const deltaX = e . pageX - dragState . startMouseX
526
529
const deltaY = e . pageY - dragState . startMouseY
527
530
// 要换算为 right 数字
528
- const newRight = dragState . startElementDisToRight - deltaX
531
+ const newRight = Math . max ( 30 - TOC_BAR_WIDTH , dragState . startElementDisToRight - deltaX )
529
532
const newTop = Math . max ( 0 , dragState . startPositionY + deltaY )
530
533
Object . assign ( dragState , {
531
534
curTop : newTop ,
You can’t perform that action at this time.
0 commit comments