本文整理汇总了TypeScript中models/tools/toolbar_base.ToolbarBase类的典型用法代码示例。如果您正苦于以下问题:TypeScript ToolbarBase类的具体用法?TypeScript ToolbarBase怎么用?TypeScript ToolbarBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToolbarBase类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe("_active_change method", () => {
let pan_1: PanTool
let pan_2: PanTool
let toolbar_base: ToolbarBase
beforeEach(() => {
// by default these tools are inactive
pan_1 = new PanTool()
pan_2 = new PanTool()
toolbar_base = new ToolbarBase()
toolbar_base.gestures.pan.tools = [new PanTool(), new PanTool()]
})
it("should correctly activate tool with currently active tool", () => {
pan_1.active = true
toolbar_base._active_change(pan_1)
expect(pan_1.active).to.be.true
expect(pan_2.active).to.be.false
expect(toolbar_base.gestures.pan.active).to.be.equal(pan_1)
})
it("should correctly deactivate tool", () => {
// activate the tool as setup
pan_1.active = true
toolbar_base._active_change(pan_1)
// now deactivate the tool
pan_1.active = false
toolbar_base._active_change(pan_1)
expect(pan_1.active).to.be.false
expect(pan_2.active).to.be.false
expect(toolbar_base.gestures.pan.active).to.be.null
})
it("should correctly active tool and deactive currently active one", () => {
// activate the tool as setup
pan_1.active = true
toolbar_base._active_change(pan_1)
// now activate the other tool
pan_2.active = true
toolbar_base._active_change(pan_2)
expect(pan_1.active).to.be.false
expect(pan_2.active).to.be.true
expect(toolbar_base.gestures.pan.active).to.be.equal(pan_2)
})
})
示例2: it
it("should correctly deactivate tool", () => {
// activate the tool as setup
pan_1.active = true
toolbar_base._active_change(pan_1)
// now deactivate the tool
pan_1.active = false
toolbar_base._active_change(pan_1)
expect(pan_1.active).to.be.false
expect(pan_2.active).to.be.false
expect(toolbar_base.gestures.pan.active).to.be.null
})