API > @blocksuite/blocks > Renderer
Class: Renderer ​
Implements ​
Constructors ​
constructor ​
new Renderer():
Renderer
Returns ​
Defined In ​
packages/blocks/src/surface-block/renderer.ts:82
Properties ​
_center ​
private
_center:object
Type declaration ​
\_center.x
​x:
number
=0
\_center.y
​y:
number
=0
Defined In ​
packages/blocks/src/surface-block/renderer.ts:78
_container ​
private
_container:HTMLElement
Defined In ​
packages/blocks/src/surface-block/renderer.ts:71
_height ​
private
_height:number
=0
Defined In ​
packages/blocks/src/surface-block/renderer.ts:75
_left ​
private
_left:number
=0
Defined In ​
packages/blocks/src/surface-block/renderer.ts:72
_overlays ​
private
_overlays:Set
<Overlay
>
Defined In ​
packages/blocks/src/surface-block/renderer.ts:70
_rafId ​
private
_rafId:null
|number
=null
Defined In ​
packages/blocks/src/surface-block/renderer.ts:80
_shouldUpdate ​
private
_shouldUpdate:boolean
=false
Defined In ​
packages/blocks/src/surface-block/renderer.ts:79
_top ​
private
_top:number
=0
Defined In ​
packages/blocks/src/surface-block/renderer.ts:73
_width ​
private
_width:number
=0
Defined In ​
packages/blocks/src/surface-block/renderer.ts:74
_zoom ​
private
_zoom:number
=1.0
Defined In ​
packages/blocks/src/surface-block/renderer.ts:77
canvas ​
canvas:
HTMLCanvasElement
Defined In ​
packages/blocks/src/surface-block/renderer.ts:61
ctx ​
ctx:
CanvasRenderingContext2D
Defined In ​
packages/blocks/src/surface-block/renderer.ts:62
gridManager ​
gridManager:
GridManager
Defined In ​
packages/blocks/src/surface-block/renderer.ts:64
rc ​
rc:
RoughCanvas
Defined In ​
packages/blocks/src/surface-block/renderer.ts:63
slots ​
slots:
object
Type declaration ​
slots.viewportUpdated
​viewportUpdated:
Slot
< {center
:IVec
;zoom
:number
;} >
Defined In ​
packages/blocks/src/surface-block/renderer.ts:66
Accessors ​
boundingClientRect ​
get
boundingClientRect():DOMRect
Defined In ​
packages/blocks/src/surface-block/renderer.ts:171
Implementation of ​
SurfaceViewport
.boundingClientRect
center ​
get
center():object
Defined In ​
packages/blocks/src/surface-block/renderer.ts:124
Implementation of ​
centerX ​
get
centerX():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:116
Implementation of ​
centerY ​
get
centerY():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:120
Implementation of ​
height ​
get
height():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:108
Implementation of ​
left ​
get
left():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:96
Implementation of ​
top ​
get
top():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:100
Implementation of ​
translateX ​
get
translateX():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:138
translateY ​
get
translateY():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:142
viewportBounds ​
get
viewportBounds():Bound
Defined In ​
packages/blocks/src/surface-block/renderer.ts:162
Implementation of ​
SurfaceViewport
.viewportBounds
viewportMaxXY ​
get
viewportMaxXY():object
Defined In ​
packages/blocks/src/surface-block/renderer.ts:154
Implementation of ​
viewportMinXY ​
get
viewportMinXY():object
Defined In ​
packages/blocks/src/surface-block/renderer.ts:146
Implementation of ​
viewportX ​
get
viewportX():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:128
Implementation of ​
viewportY ​
get
viewportY():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:133
Implementation of ​
width ​
get
width():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:104
Implementation of ​
zoom ​
get
zoom():number
Defined In ​
packages/blocks/src/surface-block/renderer.ts:112
Implementation of ​
Methods ​
_emitViewportUpdatedSlot ​
private
_emitViewportUpdatedSlot():void
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:89
_loop ​
private
_loop():void
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:377
_render ​
private
_render():void
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:387
_renderByBound ​
private
_renderByBound(ctx
,matrix
,rc
,bound
,surfaceElements
?):void
Parameters ​
Parameter | Type |
---|---|
ctx | null | CanvasRenderingContext2D |
matrix | DOMMatrix |
rc | RoughCanvas |
bound | IBound |
surfaceElements ? | SurfaceElement < ISurfaceElement , ISurfaceElementLocalRecord >[] |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:401
_resetSize ​
private
_resetSize():void
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:359
addElement ​
addElement(
element
):void
Parameters ​
Parameter | Type |
---|---|
element | SurfaceElement < ISurfaceElement , ISurfaceElementLocalRecord > |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:311
addOverlay ​
addOverlay(
overlay
):void
Parameters ​
Parameter | Type |
---|---|
overlay | Overlay |
Returns ​
void
Implementation of ​
Defined In ​
packages/blocks/src/surface-block/renderer.ts:458
applyDeltaCenter ​
applyDeltaCenter(
deltaX
,deltaY
):void
Parameters ​
Parameter | Type |
---|---|
deltaX | number |
deltaY | number |
Returns ​
void
Implementation of ​
SurfaceViewport
.applyDeltaCenter
Defined In ​
packages/blocks/src/surface-block/renderer.ts:306
attach ​
attach(
container
):void
Parameters ​
Parameter | Type |
---|---|
container | HTMLElement |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:332
getCanvasByBound ​
getCanvasByBound(
bound
,surfaceElements
?):HTMLCanvasElement
Parameters ​
Parameter | Type |
---|---|
bound | IBound |
surfaceElements ? | SurfaceElement < ISurfaceElement , ISurfaceElementLocalRecord >[] |
Returns ​
HTMLCanvasElement
Implementation of ​
SurfaceViewport
.getCanvasByBound
Defined In ​
packages/blocks/src/surface-block/renderer.ts:438
isInViewport ​
isInViewport(
bound
):boolean
Parameters ​
Parameter | Type |
---|---|
bound | Bound |
Returns ​
boolean
Implementation of ​
Defined In ​
packages/blocks/src/surface-block/renderer.ts:175
load ​
load(
elements
):void
Parameters ​
Parameter | Type |
---|---|
elements | SurfaceElement < ISurfaceElement , ISurfaceElementLocalRecord >[] |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:321
onResize ​
onResize():
void
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:341
refresh ​
refresh():
void
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:328
removeElement ​
removeElement(
element
):void
Parameters ​
Parameter | Type |
---|---|
element | SurfaceElement < ISurfaceElement , ISurfaceElementLocalRecord > |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:316
removeOverlay ​
removeOverlay(
overlay
):void
Parameters ​
Parameter | Type |
---|---|
overlay | Overlay |
Returns ​
void
Implementation of ​
Defined In ​
packages/blocks/src/surface-block/renderer.ts:463
setCenter ​
setCenter(
centerX
,centerY
):void
Parameters ​
Parameter | Type |
---|---|
centerX | number |
centerY | number |
Returns ​
void
Implementation of ​
Defined In ​
packages/blocks/src/surface-block/renderer.ts:193
setViewport ​
setViewport(
newZoom
,newCenter
=...
,smooth
=false
):void
Parameters ​
Parameter | Type | Default value |
---|---|---|
newZoom | number | undefined |
newCenter | number [] | undefined |
smooth | boolean | false |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:221
setViewportByBound ​
setViewportByBound(
bound
,padding
=...
,smooth
=false
):void
Parameters ​
Parameter | Type | Default value |
---|---|---|
bound | Bound | undefined |
padding | [number , number , number , number ] | undefined |
smooth | boolean | false |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:246
setZoom ​
setZoom(
zoom
,focusPoint
?):void
Parameters ​
Parameter | Type | Description |
---|---|---|
zoom | number | zoom |
focusPoint ? | IPoint | canvas coordinate |
Returns ​
void
Implementation of ​
Defined In ​
packages/blocks/src/surface-block/renderer.ts:205
smoothTranslate ​
smoothTranslate(
x
,y
):void
Parameters ​
Parameter | Type |
---|---|
x | number |
y | number |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:283
smoothZoom ​
smoothZoom(
zoom
,focusPoint
?):void
Parameters ​
Parameter | Type |
---|---|
zoom | number |
focusPoint ? | IPoint |
Returns ​
void
Defined In ​
packages/blocks/src/surface-block/renderer.ts:265
toModelCoord ​
toModelCoord(
viewX
,viewY
): [number
,number
]
Parameters ​
Parameter | Type |
---|---|
viewX | number |
viewY | number |
Returns ​
[number
, number
]
Implementation of ​
Defined In ​
packages/blocks/src/surface-block/renderer.ts:183
toViewCoord ​
toViewCoord(
modelX
,modelY
): [number
,number
]
Parameters ​
Parameter | Type |
---|---|
modelX | number |
modelY | number |
Returns ​
[number
, number
]
Implementation of ​
Defined In ​
packages/blocks/src/surface-block/renderer.ts:188