本文整理汇总了TypeScript中@bokehjs/core/hittest.create_hit_test_result_from_hits函数的典型用法代码示例。如果您正苦于以下问题:TypeScript create_hit_test_result_from_hits函数的具体用法?TypeScript create_hit_test_result_from_hits怎么用?TypeScript create_hit_test_result_from_hits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_hit_test_result_from_hits函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should add vertex on tap after doubletap ", function(): void {
const testcase = make_testcase()
const hit_test_stub = sinon.stub(testcase.glyph_view, "hit_test")
const vertex_hit_test_stub = sinon.stub(testcase.vertex_glyph_view, "hit_test")
hit_test_stub.returns(create_hit_test_result_from_hits([[1, 0]]))
vertex_hit_test_stub.returns(null)
const tap_event = make_tap_event(300, 300)
testcase.draw_tool_view._doubletap(tap_event) // Poly selected
vertex_hit_test_stub.returns(create_hit_test_result_from_hits([[1, 0]]))
testcase.vertex_renderer.view.compute_indices()
testcase.draw_tool_view._doubletap(tap_event) // Vertex selected
vertex_hit_test_stub.returns(create_hit_test_result_from_hits([[2, 0]]))
const tap_event2 = make_tap_event(290, 290)
const moveenter_event = make_move_event(290, 290)
const key_event = make_key_event(Keys.Esc)
testcase.draw_tool_view._tap(tap_event2) // Add new vertex
testcase.draw_tool_view._move_enter(moveenter_event)
testcase.draw_tool_view._keyup(key_event) // Stop editing
const xs = [0, 0.5, 0.04424778761061947, 1]
const ys = [0, -0.5, -0, -1]
expect(testcase.vertex_source.selected.indices).to.be.deep.equal([])
expect(testcase.vertex_source.data.x).to.be.deep.equal(xs)
expect(testcase.vertex_source.data.y).to.be.deep.equal(ys)
expect(testcase.data_source.data.xs).to.be.deep.equal([[0, 0.5, 1], xs])
expect(testcase.data_source.data.ys).to.be.deep.equal([[0, -0.5, -1], ys])
expect(testcase.data_source.data.z).to.be.deep.equal([null, null])
})
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:29,代码来源:poly_edit_tool.ts
示例2: it
it("should drag all selected points on pan", function(): void {
const testcase = make_testcase()
const hit_test_stub = sinon.stub(testcase.glyph_view, "hit_test")
hit_test_stub.returns(create_hit_test_result_from_hits([[1, 0]]))
const tap_event = make_tap_event(300, 300)
testcase.draw_tool_view._tap(tap_event)
hit_test_stub.returns(create_hit_test_result_from_hits([[2, 0]]))
let drag_event = make_gesture_event(300, 300, true)
testcase.draw_tool_view._pan_start(drag_event)
expect(testcase.draw_tool_view._basepoint).to.be.deep.equal([300, 300])
drag_event = make_gesture_event(200, 200)
testcase.draw_tool_view._pan(drag_event)
expect(testcase.draw_tool_view._basepoint).to.be.deep.equal([200, 200])
drag_event = make_gesture_event(200, 200)
testcase.draw_tool_view._pan_end(drag_event)
expect(testcase.draw_tool_view._basepoint).to.be.equal(null)
expect(testcase.data_source.selected.indices).to.be.deep.equal([])
expect(testcase.data_source.data.x).to.be.deep.equal([0, 0.14601769911504425, 0.6460176991150443])
expect(testcase.data_source.data.y).to.be.deep.equal([0, 0.8389830508474576, 1.3389830508474576])
expect(testcase.data_source.data.z).to.be.deep.equal([null, null, null])
})
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:25,代码来源:point_draw_tool.ts
示例3: it
it("should select multiple patches on shift-tap", function() {
const testcase = make_testcase()
const hit_test_stub = sinon.stub(testcase.glyph_view, "hit_test")
hit_test_stub.returns(create_hit_test_result_from_hits([[1, 0]]))
let tap_event = make_tap_event(300, 300)
testcase.draw_tool_view._tap(tap_event)
hit_test_stub.returns(create_hit_test_result_from_hits([[0, 0]]))
tap_event = make_tap_event(560, 560, true)
testcase.draw_tool_view._tap(tap_event)
expect(testcase.data_source.selected.indices).to.be.deep.equal([0, 1])
})
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:13,代码来源:freehand_draw_tool.ts
示例4: it
it("should return true if hit_test_result is not empty", () => {
const hit_test_result = create_hit_test_result_from_hits([[0, 0], [1, 0]])
const policy = new NodesOnly()
expect(policy.do_selection(hit_test_result, gr, true, false)).to.be.true
expect(node_source.selected.is_empty()).to.be.false
})
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:7,代码来源:graph_hit_test_policy.ts
示例5: it
it("should return true and set source inspected if hit_test result is not empty", function() {
this.glyph_stub.returns(create_hit_test_result_from_hits([[1, 2]]))
const source = this.renderer_view.model.data_source
const did_hit = source.selection_manager.inspect(this.renderer_view, "geometry")
expect(did_hit).to.be.true
expect(source.inspected.indices).to.be.deep.equal([1])
})
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:8,代码来源:selection_manager.ts
注:本文中的@bokehjs/core/hittest.create_hit_test_result_from_hits函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论