mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-07 17:04:58 +01:00
increase pick limit
This commit is contained in:
parent
0dfc9a73be
commit
2bae555c8d
3 changed files with 9 additions and 4 deletions
|
|
@ -92,14 +92,16 @@ export class AddCircleDimTool extends Tool {
|
|||
|
||||
mousemove(e) {
|
||||
var p = this.viewer.screenToModel(e);
|
||||
var objects = this.viewer.search(p.x, p.y, 20 / this.viewer.scale, true, false, []).filter(function (o) {
|
||||
var objects = this.viewer.search(p.x, p.y, 20, true, false, []).filter(function (o) {
|
||||
return o._class === 'TCAD.TWO.Circle' || o._class === 'TCAD.TWO.Arc';
|
||||
});
|
||||
|
||||
if (objects.length != 0) {
|
||||
this.dim.obj = objects[0];
|
||||
this.viewer.capture('tool', [this.dim.obj], true);
|
||||
} else {
|
||||
this.dim.obj = null;
|
||||
this.viewer.withdrawAll('tool');
|
||||
}
|
||||
if (this.dim.obj != null) {
|
||||
this.dim.angle = Math.atan2(p.y - this.dim.obj.c.y, p.x - this.dim.obj.c.x);
|
||||
|
|
@ -113,6 +115,8 @@ export class AddCircleDimTool extends Tool {
|
|||
} else {
|
||||
this.viewer.remove(this.dim);
|
||||
}
|
||||
this.viewer.withdrawAll('tool');
|
||||
this.viewer.refresh();
|
||||
this.viewer.toolManager.releaseControl();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ export class LoopPickTool extends Tool {
|
|||
};
|
||||
|
||||
pickLoop(p) {
|
||||
const pickResult = this.viewer.search(p.x, p.y, 20 / this.viewer.scale, true, false, []);
|
||||
const pickResult = this.viewer.search(p.x, p.y, 20, true, false, []);
|
||||
for (let obj of pickResult) {
|
||||
for (let point of [obj.a, obj.b]) {
|
||||
const loop = this.loops.get(point);
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ class Viewer {
|
|||
|
||||
search(x, y, buffer, deep, onlyPoints, filter) {
|
||||
|
||||
buffer /= this.scale / this.retinaPxielRatio;
|
||||
buffer *= 0.5;
|
||||
|
||||
var pickResult = [];
|
||||
|
|
@ -292,7 +293,7 @@ class Viewer {
|
|||
|
||||
snap(x, y, excl) {
|
||||
this.cleanSnap();
|
||||
const snapTo = this.search(x, y, 20 / this.scale, true, true, excl);
|
||||
const snapTo = this.search(x, y, 20, true, true, excl);
|
||||
if (snapTo.length > 0) {
|
||||
this.capture('tool', [snapTo[0]], true);
|
||||
}
|
||||
|
|
@ -469,7 +470,7 @@ class Viewer {
|
|||
|
||||
pick(e) {
|
||||
const m = this.screenToModel(e);
|
||||
return this.search(m.x, m.y, 20 / this.scale, true, false, []);
|
||||
return this.search(m.x, m.y, 20, true, false, []);
|
||||
};
|
||||
|
||||
getActiveLayer() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue