本文整理汇总了TypeScript中cursor/direct-cursor.DirectCursor.setCursorURL方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DirectCursor.setCursorURL方法的具体用法?TypeScript DirectCursor.setCursorURL怎么用?TypeScript DirectCursor.setCursorURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cursor/direct-cursor.DirectCursor
的用法示例。
在下文中一共展示了DirectCursor.setCursorURL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: renderShape
renderShape( render:RenderFunction ):void {
if ( render !== null ) {
const zoomSize = this.getZoomSize()
this.shape = render
if ( ! this.isHidden ) {
// draws a cross hair
if ( zoomSize <= BRUSH_CURSOR_MINIMUM_SIZE ) {
this.setCrosshair()
} else {
const canvas = this.canvas
const ctx = canvas.getContext( '2d' ) as CanvasRenderingContext2D
const canvasSize = zoomSize + BRUSH_CURSOR_PADDING
canvas.width = canvas.height = canvasSize
ctx.beginPath()
ctx.lineCap = 'round'
ctx.lineWidth = 1
this.shape( ctx, canvas, zoomSize )
const middle = canvas.width/2
// draw a dot in the centre
ctx.beginPath()
ctx.strokeStyle = '#fff'
ctx.globalAlpha = 0.9
ctx.strokeRect( middle-0.75, middle-0.75, 1.5, 1.5 )
ctx.strokeStyle = '#000'
ctx.globalAlpha = 0.6
ctx.strokeRect( middle-0.5 , middle-0.5 , 1 , 1 )
this.cursor.setCursorURL( canvas.toDataURL(), canvas.width )
}
}
}
}
示例2: setCrosshair
setCrosshair():this {
this.cursor.setCursorURL( CROSSHAIR_CURSOR_DATA_URL, CROSSHAIR_CURSOR_SIZE )
this.shape = null
return this
}