BlockSuite API Documentation / @blocksuite/blocks / Viewport
Class: Viewport
Constructors
new Viewport()
new Viewport():
Viewport
Returns
Properties
ZOOM_MAX
ZOOM_MAX:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:148
ZOOM_MIN
ZOOM_MIN:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:150
_center
protected
_center:IPoint
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:136
_cumulativeParentScale
protected
_cumulativeParentScale:number
=1
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:144
_el
protected
_el:HTMLElement
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:142
_height
protected
_height:number
=0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:134
_left
protected
_left:number
=0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:128
_locked
protected
_locked:boolean
=false
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:146
_rafId
protected
_rafId:null
|number
=null
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:140
_syncFlag
private
_syncFlag:boolean
=false
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:126
_top
protected
_top:number
=0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:130
_width
protected
_width:number
=0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:132
_zoom
protected
_zoom:number
=1.0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:138
sizeUpdated
sizeUpdated:
Slot
<object
>
Type declaration
height
height:
number
left
left:
number
top
top:
number
width
width:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:156
viewportMoved
viewportMoved:
Slot
<IVec2
>
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:154
viewportUpdated
viewportUpdated:
Slot
<object
>
Type declaration
center
center:
IVec2
zoom
zoom:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:152
Accessors
boundingClientRect
get
boundingClientRect():DOMRect
Returns
DOMRect
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:104
center
get
center():IPoint
Returns
IPoint
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:45
centerX
get
centerX():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:37
centerY
get
centerY():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:41
cumulativeParentScale
get
cumulativeParentScale():number
Deprecated
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:56
height
get
height():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:33
left
get
left():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:21
locked
get
locked():boolean
set
locked(locked
):void
Parameters
• locked: boolean
Returns
boolean
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:118
scale
get
scale():number
Note this is different from the zoom property. The editor itself may be scaled by outer container which is common in nested editor scenarios. This property is used to calculate the scale of the editor.
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:113
top
get
top():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:25
translateX
get
translateX():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:70
translateY
get
translateY():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:74
viewportBounds
get
viewportBounds():Bound
Returns
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:94
viewportMaxXY
get
viewportMaxXY():object
Returns
object
x
x:
number
y
y:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:86
viewportMinXY
get
viewportMinXY():object
Returns
object
x
x:
number
y
y:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:78
viewportX
get
viewportX():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:60
viewportY
get
viewportY():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:65
width
get
width():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:29
zoom
get
zoom():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:49
Methods
applyDeltaCenter()
applyDeltaCenter(
deltaX
,deltaY
):void
Parameters
• deltaX: number
• deltaY: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:247
dispose()
dispose():
void
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:396
isInViewport()
isInViewport(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:251
onResize()
onResize():
void
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:163
setCenter()
setCenter(
centerX
,centerY
):void
Parameters
• centerX: number
• centerY: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:220
setContainer()
setContainer(
container
):void
Parameters
• container: HTMLElement
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:175
setRect()
setRect(
left
,top
,width
,height
):void
Parameters
• left: number
• top: number
• width: number
• height: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:303
setViewport()
setViewport(
newZoom
,newCenter
,smooth
):void
Parameters
• newZoom: number
• newCenter: number
[]= undefined
• smooth: boolean
= false
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:259
setViewportByBound()
setViewportByBound(
bound
,padding
,smooth
):void
Parameters
• bound: Bound
• padding: [number
, number
, number
, number
]= undefined
• smooth: boolean
= false
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:284
setZoom()
setZoom(
zoom
,focusPoint
?):void
Parameters
• zoom: number
• focusPoint?: IPoint
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:229
smoothTranslate()
smoothTranslate(
x
,y
):void
Parameters
• x: number
• y: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:334
smoothZoom()
smoothZoom(
zoom
,focusPoint
?):void
Parameters
• zoom: number
• focusPoint?: IPoint
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:316
sync()
sync(
viewport
): () =>void
Parameters
• viewport: Viewport
Returns
Function
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:357
toModelBound()
toModelBound(
bound
):Bound
Parameters
• bound: Bound
Returns
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:206
toModelCoord()
toModelCoord(
viewX
,viewY
):IVec2
Parameters
• viewX: number
• viewY: number
Returns
IVec2
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:193
toModelCoordFromClientCoord()
toModelCoordFromClientCoord(
__namedParameters
):IVec2
Parameters
• __namedParameters: IVec2
Returns
IVec2
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:188
toViewBound()
toViewBound(
bound
):Bound
Parameters
• bound: Bound
Returns
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:213
toViewCoord()
toViewCoord(
modelX
,modelY
):IVec2
Parameters
• modelX: number
• modelY: number
Returns
IVec2
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:198
toViewCoordFromClientCoord()
toViewCoordFromClientCoord(
__namedParameters
):IVec2
Parameters
• __namedParameters: IVec2
Returns
IVec2
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:183