本文整理匯總了TypeScript中src/dvu/core/helpers/svg.SVG.createEllipse方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SVG.createEllipse方法的具體用法?TypeScript SVG.createEllipse怎麽用?TypeScript SVG.createEllipse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類src/dvu/core/helpers/svg.SVG
的用法示例。
在下文中一共展示了SVG.createEllipse方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: PictureCommand
import {PictureCommand} from 'src/dvu/core/commands/picture'
import {PictureContext} from 'src/dvu/geometry/picture_context'
import {SVG} from 'src/dvu/core/helpers/svg'
export const ELLIPSIS = new PictureCommand('Circle', {
name: 'circle',
shortcutKey: 'c',
noOfInstances: 0,
onMousedown(context: PictureContext): Element {
const { start, end } = context
const ellipsis = SVG.createEllipse(start.x, start.y, context.getWidth(), context.getHeight())
ellipsis.setAttributeNS(null, 'stroke', '#555')
ellipsis.setAttributeNS(null, 'fill', 'transparent')
return ellipsis
},
onMousemove(element: Element, context: PictureContext): Element {
const { start, end } = context
const rx = context.getWidth(), ry = context.getHeight()
element.setAttributeNS(null, 'rx', rx.toString())
element.setAttributeNS(null, 'ry', ry.toString())
return element
},
onMouseup(element: Element, context: PictureContext): Element {
return this.onMousedown(element, context)