mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-15 12:53:52 +01:00
change default tool for circle
This commit is contained in:
parent
8b6420591f
commit
f4b203d96c
2 changed files with 13 additions and 4 deletions
|
|
@ -292,6 +292,10 @@ TCAD.TWO.SketchObject.prototype.visit = function(onlyVisible, h) {
|
|||
return h(this);
|
||||
};
|
||||
|
||||
TCAD.TWO.SketchObject.prototype.getDefaultTool = function(viewer) {
|
||||
return new TCAD.TWO.DragTool(this, viewer);
|
||||
};
|
||||
|
||||
TCAD.TWO.SketchObject.prototype._translate = function(dx, dy, translated) {
|
||||
translated[this.id] = 'x';
|
||||
for (var i = 0; i < this.linked.length; ++i) {
|
||||
|
|
@ -526,9 +530,9 @@ TCAD.TWO.PanTool.prototype.mousedown = function(e) {
|
|||
} else {
|
||||
this.viewer.select([picked[0]], true);
|
||||
if (!picked[0].aux) {
|
||||
var dragTool = new TCAD.TWO.DragTool(picked[0], this.viewer);
|
||||
dragTool.mousedown(e);
|
||||
this.viewer.toolManager.takeControl(dragTool);
|
||||
var tool = picked[0].getDefaultTool(this.viewer);
|
||||
tool.mousedown(e);
|
||||
this.viewer.toolManager.takeControl(tool);
|
||||
}
|
||||
}
|
||||
this.viewer.refresh();
|
||||
|
|
|
|||
|
|
@ -30,11 +30,16 @@ TCAD.TWO.Circle.prototype.drawImpl = function(ctx, scale) {
|
|||
ctx.stroke();
|
||||
};
|
||||
|
||||
|
||||
TCAD.TWO.Circle.prototype.normalDistance = function(aim) {
|
||||
return Math.abs(TCAD.math.distance(aim.x, aim.y, this.c.x, this.c.y) - this.r.get());
|
||||
};
|
||||
|
||||
TCAD.TWO.Circle.prototype.getDefaultTool = function(viewer) {
|
||||
var editTool = new TCAD.TWO.EditCircleTool(viewer, null);
|
||||
editTool.circle = this;
|
||||
return editTool;
|
||||
};
|
||||
|
||||
|
||||
TCAD.TWO.EditCircleTool = function(viewer, layer) {
|
||||
this.viewer = viewer;
|
||||
|
|
|
|||
Loading…
Reference in a new issue