本文整理汇总了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")
}
示例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")
}
示例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")
}