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


TypeScript canvas.fixup_ctx函數代碼示例

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


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

示例1: initialize

  initialize(options: any): void {
    super.initialize(options)

    this.map_el = this.model.map ? this.el.appendChild(div({class: "bk-canvas-map"})) : null

    switch (this.model.output_backend) {
      case "canvas":
      case "webgl": {
        this.canvas_el = this.el.appendChild(canvas({class: "bk-canvas"}))
        const ctx = this.canvas_el.getContext('2d')
        if (ctx == null)
          throw new Error("unable to obtain 2D rendering context")
        this._ctx = ctx
        break
      }
      case "svg": {
        const ctx = new SVGRenderingContext2D()
        this._ctx = ctx
        this.canvas_el = this.el.appendChild(ctx.getSvg())
        break
      }
    }

    this.overlays_el = this.el.appendChild(div({class: "bk-canvas-overlays"}))
    this.events_el   = this.el.appendChild(div({class: "bk-canvas-events"}))

    fixup_ctx(this._ctx)

    logger.debug("CanvasView initialized")
  }
開發者ID:,項目名稱:,代碼行數:30,代碼來源:

示例2: initialize

  initialize(options: any): void {
    super.initialize(options)

    this.map_el = this.model.map ? this.el.appendChild(div({class: "bk-canvas-map"})) : null

    switch (this.model.output_backend) {
      case "canvas":
      case "webgl":
        this.canvas_el = this.el.appendChild(canvas({class: "bk-canvas"}))
        this._ctx = this.canvas_el.getContext('2d')
        break
      case "svg":
        this._ctx = new canvas2svg()
        this.canvas_el = this.el.appendChild(this._ctx.getSvg())
        break
    }

    this.overlays_el = this.el.appendChild(div({class: "bk-canvas-overlays"}))
    this.events_el   = this.el.appendChild(div({class: "bk-canvas-events"}))

    this.ctx = this.get_ctx()
    // work around canvas incompatibilities
    fixup_ctx(this.ctx)

    logger.debug("CanvasView initialized")
  }
開發者ID:gully,項目名稱:bokeh,代碼行數:26,代碼來源:canvas.ts

示例3: initialize

  initialize(): void {
    super.initialize()

    this.map_el = this.model.map ? this.el.appendChild(div({class: "bk-canvas-map"})) : null

    const style = {
      position: "absolute",
      top: "0",
      left: "0",
      width: "100%",
      height: "100%",
    }

    switch (this.model.output_backend) {
      case "canvas":
      case "webgl": {
        this.canvas_el = this.el.appendChild(canvas({class: "bk-canvas", style}))
        const ctx = this.canvas_el.getContext('2d')
        if (ctx == null)
          throw new Error("unable to obtain 2D rendering context")
        this._ctx = ctx
        break
      }
      case "svg": {
        const ctx = new canvas2svg() as SVGRenderingContext2D
        this._ctx = ctx
        this.canvas_el = this.el.appendChild(ctx.getSvg())
        break
      }
    }

    this.overlays_el = this.el.appendChild(div({class: "bk-canvas-overlays", style}))
    this.events_el   = this.el.appendChild(div({class: "bk-canvas-events", style}))

    fixup_ctx(this._ctx)

    logger.debug("CanvasView initialized")
  }
開發者ID:digitalsatori,項目名稱:Bokeh,代碼行數:38,代碼來源:canvas.ts


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