當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript direct-cursor.DirectCursor類代碼示例

本文整理匯總了TypeScript中cursor/direct-cursor.DirectCursor的典型用法代碼示例。如果您正苦於以下問題:TypeScript DirectCursor類的具體用法?TypeScript DirectCursor怎麽用?TypeScript DirectCursor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DirectCursor類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: setCommandCursor

  setCommandCursor( painter:SkyBrush, command:Command ) {
    const cursor = command.getCursor()

    if ( cursor === null ) {
      this.cursor.setBlankCursor()
    } else if ( typeof cursor === 'string' ) {
      this.cursor.setClass( cursor )
    } else {
      cursor.call( command, this, painter )
    }

    return this
  }
開發者ID:PlayMyCode,項目名稱:SkyBrush,代碼行數:13,代碼來源:brush-cursor.ts

示例2: hideInner

  hideInner():this {
    if ( ! this.isReallyHidden ) {
      this.isReallyHidden = true
      this.cursor.hide()
    }

    return this
  }
開發者ID:PlayMyCode,項目名稱:SkyBrush,代碼行數:8,代碼來源:brush-cursor.ts

示例3: showInner

  showInner():this {
    if ( this.isReallyHidden ) {
      this.isReallyHidden = false

      this.cursor.show()
    }

    return this
  }
開發者ID:PlayMyCode,項目名稱:SkyBrush,代碼行數:9,代碼來源:brush-cursor.ts

示例4: 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 )
        }
      }
    }
  }
開發者ID:PlayMyCode,項目名稱:SkyBrush,代碼行數:41,代碼來源:brush-cursor.ts

示例5: setClass

  setClass( klass:string ) {
    this.cursor.setClass( klass )
    this.shape = null

    return this
  }
開發者ID:PlayMyCode,項目名稱:SkyBrush,代碼行數:6,代碼來源:brush-cursor.ts

示例6: onMove

  onMove( ev:MouseEvent ):this {
    this.cursor.update( ev )

    return this
  }
開發者ID:PlayMyCode,項目名稱:SkyBrush,代碼行數:5,代碼來源:brush-cursor.ts

示例7: setCrosshair

  setCrosshair():this {
    this.cursor.setCursorURL( CROSSHAIR_CURSOR_DATA_URL, CROSSHAIR_CURSOR_SIZE )
    this.shape = null

    return this
  }
開發者ID:PlayMyCode,項目名稱:SkyBrush,代碼行數:6,代碼來源:brush-cursor.ts


注:本文中的cursor/direct-cursor.DirectCursor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。