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:33
ZOOM_MIN
ZOOM_MIN:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:34
_center
protected
_center:IPoint
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:25
_cumulativeParentScale
protected
_cumulativeParentScale:number
=1
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:30
_el
protected
_el:HTMLElement
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:28
_height
protected
_height:number
=0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:24
_left
protected
_left:number
=0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:21
_locked
protected
_locked:boolean
=false
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:31
_rafId
protected
_rafId:null
|number
=null
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:27
_syncFlag
private
_syncFlag:boolean
=false
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:29
_top
protected
_top:number
=0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:22
_width
protected
_width:number
=0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:23
_zoom
protected
_zoom:number
=1.0
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:26
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:38
viewportMoved
viewportMoved:
Slot
<IVec2
>
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:37
viewportUpdated
viewportUpdated:
Slot
<object
>
Type declaration
center
center:
IVec2
zoom
zoom:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:36
Accessors
boundingClientRect
get
boundingClientRect():DOMRect
Returns
DOMRect
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:124
center
get
center():IPoint
Returns
IPoint
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:69
centerX
get
centerX():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:61
centerY
get
centerY():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:65
cumulativeParentScale
get
cumulativeParentScale():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:77
height
get
height():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:57
left
get
left():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:45
locked
get
locked():boolean
set
locked(locked
):void
Parameters
• locked: boolean
Returns
boolean
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:129
top
get
top():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:49
translateX
get
translateX():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:91
translateY
get
translateY():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:95
viewportBounds
get
viewportBounds():Bound
Returns
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:115
viewportMaxXY
get
viewportMaxXY():object
Returns
object
x
x:
number
y
y:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:107
viewportMinXY
get
viewportMinXY():object
Returns
object
x
x:
number
y
y:
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:99
viewportX
get
viewportX():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:81
viewportY
get
viewportY():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:86
width
get
width():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:53
zoom
get
zoom():number
Returns
number
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:73
Methods
applyDeltaCenter()
applyDeltaCenter(
deltaX
,deltaY
):void
Parameters
• deltaX: number
• deltaY: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:220
dispose()
dispose():
void
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:369
isInViewport()
isInViewport(
bound
):boolean
Parameters
• bound: Bound
Returns
boolean
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:224
onResize()
onResize():
void
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:137
setCenter()
setCenter(
centerX
,centerY
):void
Parameters
• centerX: number
• centerY: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:189
setContainer()
setContainer(
container
):void
Parameters
• container: HTMLElement
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:149
setCumulativeParentScale()
setCumulativeParentScale(
scale
):void
Parameters
• scale: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:216
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:276
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:232
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:257
setZoom()
setZoom(
zoom
,focusPoint
?):void
Parameters
• zoom: number
• focusPoint?: IPoint
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:198
smoothTranslate()
smoothTranslate(
x
,y
):void
Parameters
• x: number
• y: number
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:307
smoothZoom()
smoothZoom(
zoom
,focusPoint
?):void
Parameters
• zoom: number
• focusPoint?: IPoint
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:289
sync()
sync(
viewport
): () =>void
Parameters
• viewport: Viewport
Returns
Function
Returns
void
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:330
toModelBound()
toModelBound(
bound
):Bound
Parameters
• bound: Bound
Returns
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:175
toModelCoord()
toModelCoord(
viewX
,viewY
): [number
,number
]
Parameters
• viewX: number
• viewY: number
Returns
[number
, number
]
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:165
toViewBound()
toViewBound(
bound
):Bound
Parameters
• bound: Bound
Returns
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:182
toViewCoord()
toViewCoord(
modelX
,modelY
): [number
,number
]
Parameters
• modelX: number
• modelY: number
Returns
[number
, number
]
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:170
toViewPointFromClientPoint()
toViewPointFromClientPoint(
__namedParameters
):IPoint
Parameters
• __namedParameters: IPoint
Returns
IPoint
Source
packages/blocks/src/root-block/edgeless/utils/viewport.ts:157