BlockSuite API Documentation / @blocksuite/blocks / Renderer
Class: Renderer ​
Contents ​
- Implements
- Constructors
- Properties
- Accessors
- Methods
- _emitViewportUpdatedSlot()
- _loop()
- _render()
- _renderByBound()
- _resetSize()
- addElement()
- addOverlay()
- applyDeltaCenter()
- attach()
- getCanvasByBound()
- isInViewport()
- load()
- onResize()
- refresh()
- removeElement()
- removeOverlay()
- setCenter()
- setIndexedCanvas()
- setViewport()
- setViewportByBound()
- setZoom()
- smoothTranslate()
- smoothZoom()
- toModelCoord()
- toViewCoord()
Implements ​
Constructors ​
new Renderer(options) ​
new Renderer(
options
):Renderer
Parameters ​
• options: Object
• options.layerManager: LayerManager
Returns ​
Source ​
packages/blocks/src/surface-block/renderer.ts:86
Properties ​
_center ​
private
_center:Object
Type declaration ​
x ​
x:
number
=0
y ​
y:
number
=0
Source ​
packages/blocks/src/surface-block/renderer.ts:82
_container ​
private
_container:HTMLElement
Source ​
packages/blocks/src/surface-block/renderer.ts:75
_height ​
private
_height:number
=0
Source ​
packages/blocks/src/surface-block/renderer.ts:79
_left ​
private
_left:number
=0
Source ​
packages/blocks/src/surface-block/renderer.ts:76
_overlays ​
private
_overlays:Set
<Overlay
>
Source ​
packages/blocks/src/surface-block/renderer.ts:74
_rafId ​
private
_rafId:null
|number
=null
Source ​
packages/blocks/src/surface-block/renderer.ts:84
_shouldUpdate ​
private
_shouldUpdate:boolean
=false
Source ​
packages/blocks/src/surface-block/renderer.ts:83
_top ​
private
_top:number
=0
Source ​
packages/blocks/src/surface-block/renderer.ts:77
_width ​
private
_width:number
=0
Source ​
packages/blocks/src/surface-block/renderer.ts:78
_zoom ​
private
_zoom:number
=1.0
Source ​
packages/blocks/src/surface-block/renderer.ts:81
canvas ​
canvas:
HTMLCanvasElement
Source ​
packages/blocks/src/surface-block/renderer.ts:63
ctx ​
ctx:
CanvasRenderingContext2D
Source ​
packages/blocks/src/surface-block/renderer.ts:64
gridManager ​
gridManager:
GridManager
<SurfaceElement
<ISurfaceElement
,ISurfaceElementLocalRecord
>>
Source ​
packages/blocks/src/surface-block/renderer.ts:66
indexedCanvases ​
indexedCanvases:
HTMLCanvasElement
[] =[]
Source ​
packages/blocks/src/surface-block/renderer.ts:67
layerManager ​
layerManager:
LayerManager
Source ​
packages/blocks/src/surface-block/renderer.ts:68
rc ​
rc:
RoughCanvas
Source ​
packages/blocks/src/surface-block/renderer.ts:65
slots ​
slots:
Object
Type declaration ​
viewportUpdated ​
viewportUpdated:
Slot
<Object
>
Type declaration ​
center ​
center:
IVec
zoom ​
zoom:
number
Source ​
packages/blocks/src/surface-block/renderer.ts:70
Accessors ​
boundingClientRect ​
get
boundingClientRect():DOMRect
Returns ​
DOMRect
Source ​
packages/blocks/src/surface-block/renderer.ts:176
center ​
get
center():Object
Returns ​
Object
x ​
x:
number
=0
y ​
y:
number
=0
Source ​
packages/blocks/src/surface-block/renderer.ts:129
centerX ​
get
centerX():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:121
centerY ​
get
centerY():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:125
height ​
get
height():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:113
left ​
get
left():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:101
top ​
get
top():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:105
translateX ​
get
translateX():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:143
translateY ​
get
translateY():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:147
viewportBounds ​
get
viewportBounds():Bound
Returns ​
Source ​
packages/blocks/src/surface-block/renderer.ts:167
viewportMaxXY ​
get
viewportMaxXY():Object
Returns ​
Object
x ​
x:
number
y ​
y:
number
Source ​
packages/blocks/src/surface-block/renderer.ts:159
viewportMinXY ​
get
viewportMinXY():Object
Returns ​
Object
x ​
x:
number
y ​
y:
number
Source ​
packages/blocks/src/surface-block/renderer.ts:151
viewportX ​
get
viewportX():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:133
viewportY ​
get
viewportY():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:138
width ​
get
width():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:109
zoom ​
get
zoom():number
Returns ​
number
Source ​
packages/blocks/src/surface-block/renderer.ts:117
Methods ​
_emitViewportUpdatedSlot() ​
private
_emitViewportUpdatedSlot():void
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:94
_loop() ​
private
_loop():void
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:416
_render() ​
private
_render():void
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:426
_renderByBound() ​
private
_renderByBound(ctx
,matrix
,rc
,bound
,surfaceElements
?,overLay
?):void
Parameters ​
• ctx: null
| CanvasRenderingContext2D
• matrix: DOMMatrix
• rc: RoughCanvas
• bound: IBound
• surfaceElements?: SurfaceElement
<ISurfaceElement
, ISurfaceElementLocalRecord
>[]
• overLay?: boolean
= false
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:462
_resetSize() ​
private
_resetSize():void
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:386
addElement() ​
addElement(
element
):void
Parameters ​
• element: SurfaceElement
<ISurfaceElement
, ISurfaceElementLocalRecord
>
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:316
addOverlay() ​
addOverlay(
overlay
):void
Parameters ​
• overlay: Overlay
Returns ​
void
Implementation of ​
@blocksuite/blocks.SurfaceViewport.addOverlay
Source ​
packages/blocks/src/surface-block/renderer.ts:530
applyDeltaCenter() ​
applyDeltaCenter(
deltaX
,deltaY
):void
Parameters ​
• deltaX: number
• deltaY: number
Returns ​
void
Implementation of ​
@blocksuite/blocks.SurfaceViewport.applyDeltaCenter
Source ​
packages/blocks/src/surface-block/renderer.ts:311
attach() ​
attach(
container
):void
Used to attach main canvas, main canvas will always exist
Parameters ​
• container: HTMLElement
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:341
getCanvasByBound() ​
getCanvasByBound(
bound
,surfaceElements
?,canvas
?,clearBeforeDrawing
?,withZoom
?):HTMLCanvasElement
Parameters ​
• bound: IBound
= undefined
• surfaceElements?: SurfaceElement
<ISurfaceElement
, ISurfaceElementLocalRecord
>[]
• canvas?: HTMLCanvasElement
• clearBeforeDrawing?: boolean
• withZoom?: boolean
Returns ​
HTMLCanvasElement
Implementation of ​
@blocksuite/blocks.SurfaceViewport.getCanvasByBound
Source ​
packages/blocks/src/surface-block/renderer.ts:502
isInViewport() ​
isInViewport(
bound
):boolean
Parameters ​
• bound: Bound
Returns ​
boolean
Implementation of ​
@blocksuite/blocks.SurfaceViewport.isInViewport
Source ​
packages/blocks/src/surface-block/renderer.ts:180
load() ​
load(
elements
):void
Parameters ​
• elements: SurfaceElement
<ISurfaceElement
, ISurfaceElementLocalRecord
>[]
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:326
onResize() ​
onResize():
void
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:349
refresh() ​
refresh():
void
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:333
removeElement() ​
removeElement(
element
):void
Parameters ​
• element: SurfaceElement
<ISurfaceElement
, ISurfaceElementLocalRecord
>
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:321
removeOverlay() ​
removeOverlay(
overlay
):void
Parameters ​
• overlay: Overlay
Returns ​
void
Implementation of ​
@blocksuite/blocks.SurfaceViewport.removeOverlay
Source ​
packages/blocks/src/surface-block/renderer.ts:535
setCenter() ​
setCenter(
centerX
,centerY
):void
Parameters ​
• centerX: number
• centerY: number
Returns ​
void
Implementation of ​
@blocksuite/blocks.SurfaceViewport.setCenter
Source ​
packages/blocks/src/surface-block/renderer.ts:198
setIndexedCanvas() ​
setIndexedCanvas(
canvases
):void
Parameters ​
• canvases: HTMLCanvasElement
[]
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:367
setViewport() ​
setViewport(
newZoom
,newCenter
,smooth
):void
Parameters ​
• newZoom: number
• newCenter: number
[]= undefined
• smooth: boolean
= false
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:226
setViewportByBound() ​
setViewportByBound(
bound
,padding
,smooth
):void
Parameters ​
• bound: Bound
• padding: [number
, number
, number
, number
]= undefined
• smooth: boolean
= false
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:251
setZoom() ​
setZoom(
zoom
,focusPoint
?):void
Parameters ​
• zoom: number
zoom
• focusPoint?: IPoint
canvas coordinate
Returns ​
void
Implementation of ​
@blocksuite/blocks.SurfaceViewport.setZoom
Source ​
packages/blocks/src/surface-block/renderer.ts:210
smoothTranslate() ​
smoothTranslate(
x
,y
):void
Parameters ​
• x: number
• y: number
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:288
smoothZoom() ​
smoothZoom(
zoom
,focusPoint
?):void
Parameters ​
• zoom: number
• focusPoint?: IPoint
Returns ​
void
Source ​
packages/blocks/src/surface-block/renderer.ts:270
toModelCoord() ​
toModelCoord(
viewX
,viewY
): [number
,number
]
Parameters ​
• viewX: number
• viewY: number
Returns ​
[number
, number
]
Implementation of ​
@blocksuite/blocks.SurfaceViewport.toModelCoord
Source ​
packages/blocks/src/surface-block/renderer.ts:188
toViewCoord() ​
toViewCoord(
modelX
,modelY
): [number
,number
]
Parameters ​
• modelX: number
• modelY: number
Returns ​
[number
, number
]
Implementation of ​
@blocksuite/blocks.SurfaceViewport.toViewCoord
Source ​
packages/blocks/src/surface-block/renderer.ts:193
Generated using typedoc-plugin-markdown and TypeDoc