src/actionsEdit.cc

changeset 754
c37564d59ce1
parent 739
152b33a6d51b
child 757
8ab9fa53142b
equal deleted inserted replaced
753:0379f6fca732 754:c37564d59ce1
362 // ============================================================================= 362 // =============================================================================
363 // 363 //
364 void doMoveObjects (Vertex vect) 364 void doMoveObjects (Vertex vect)
365 { 365 {
366 // Apply the grid values 366 // Apply the grid values
367 vect.setX (vect.x() * *currentGrid().confs[Grid::X]); 367 vect *= *currentGrid().coordsnap;
368 vect.setY (vect.y() * *currentGrid().confs[Grid::Y]);
369 vect.setZ (vect.z() * *currentGrid().confs[Grid::Z]);
370 368
371 for (LDObject* obj : selection()) 369 for (LDObject* obj : selection())
372 obj->move (vect); 370 obj->move (vect);
373 371
374 g_win->refresh(); 372 g_win->refresh();
376 374
377 // ============================================================================= 375 // =============================================================================
378 // 376 //
379 DEFINE_ACTION (MoveXNeg, KEY (Left)) 377 DEFINE_ACTION (MoveXNeg, KEY (Left))
380 { 378 {
381 doMoveObjects ({ -1, 0, 0}); 379 doMoveObjects ({-1, 0, 0});
382 } 380 }
383 381
384 DEFINE_ACTION (MoveYNeg, KEY (Home)) 382 DEFINE_ACTION (MoveYNeg, KEY (Home))
385 { 383 {
386 doMoveObjects ({0, -1, 0}); 384 doMoveObjects ({0, -1, 0});
432 static void doRotate (const int l, const int m, const int n) 430 static void doRotate (const int l, const int m, const int n)
433 { 431 {
434 LDObjectList sel = selection(); 432 LDObjectList sel = selection();
435 QList<Vertex*> queue; 433 QList<Vertex*> queue;
436 const Vertex rotpoint = rotPoint (sel); 434 const Vertex rotpoint = rotPoint (sel);
437 const double angle = (pi * *currentGrid().confs[Grid::Angle]) / 180, 435 const double angle = (pi * *currentGrid().anglesnap) / 180,
438 cosangle = cos (angle), 436 cosangle = cos (angle),
439 sinangle = sin (angle); 437 sinangle = sin (angle);
440 438
441 // ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2 439 // ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2
442 Matrix transform ( 440 Matrix transform (

mercurial