本文整理匯總了TypeScript中models/tools/edit/edit_tool.BkEv.default方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BkEv.default方法的具體用法?TypeScript BkEv.default怎麽用?TypeScript BkEv.default使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models/tools/edit/edit_tool.BkEv
的用法示例。
在下文中一共展示了BkEv.default方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should drag selected on pan", function(): void {
const testcase = make_testcase();
const hit_test_stub = sinon.stub(testcase.glyph_view, "hit_test");
hit_test_stub.returns(create_1d_hit_test_result([[1, 0]]));
const tap_event = make_event(300, 300);
testcase.draw_tool_view._tap(tap_event);
let drag_event = make_event(300, 300);
testcase.draw_tool_view._pan_start(drag_event);
expect(testcase.draw_tool_view._basepoint).to.be.deep.equal([300, 300]);
drag_event = make_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_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.data['x']).to.be.deep.equal([0, 0.14601769911504425, 1]);
expect(testcase.data_source.data['y']).to.be.deep.equal([0, 0.8389830508474576, 1]);
expect(testcase.data_source.data['width']).to.be.deep.equal([0.1, 0.2, 0.3]);
expect(testcase.data_source.data['height']).to.be.deep.equal([0.3, 0.2, 0.1]);
expect(testcase.data_source.data['z']).to.be.deep.equal([null, null, null]);
})
示例2: 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_1d_hit_test_result([[1, 0]]));
vertex_hit_test_stub.returns(null);
const tap_event = make_event(300, 300);
testcase.draw_tool_view._doubletap(tap_event); // Poly selected
vertex_hit_test_stub.returns(create_1d_hit_test_result([[1, 0]]));
testcase.vertex_renderer.view.compute_indices();
testcase.draw_tool_view._doubletap(tap_event); // Vertex selected
vertex_hit_test_stub.returns(create_1d_hit_test_result([[2, 0]]));
const key_event = make_event(290, 290, false, Keys.Esc);
testcase.draw_tool_view._tap(key_event); // Add new vertex
testcase.draw_tool_view._move_enter(key_event);
testcase.draw_tool_view._keyup(key_event); // Stop editing
const xs = [0, 0.5, 0.008849557522123894, 1];
const ys = [0, -0.5, 0.03389830508474576, -1];
expect(testcase.vertex_source.selected['1d'].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]);
});
示例3: 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_1d_hit_test_result([[1, 0]]));
const tap_event = make_event(300, 300);
testcase.draw_tool_view._tap(tap_event);
hit_test_stub.returns(create_1d_hit_test_result([[2, 0]]));
let drag_event = make_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_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_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['1d'].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]);
});
示例4: 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_1d_hit_test_result([[1, 0]]));
let tap_event = make_event(300, 300);
testcase.draw_tool_view._tap(tap_event);
hit_test_stub.returns(create_1d_hit_test_result([[0, 0]]));
tap_event = make_event(560, 560, true);
testcase.draw_tool_view._tap(tap_event);
expect(testcase.data_source.selected['1d'].indices).to.be.deep.equal([1, 0]);
});