* Source/GSSlideView.m: (- _slideFrom:to:): Calcuate number of

steps wrt image size.
* Source/GSDragView.m: (- slideDraggedImageTo:): Ditto.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24831 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2007-03-09 00:21:52 +00:00
parent 4cbe55b1f8
commit 139831b3fb
3 changed files with 26 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2007-03-09 Sergii Stoian <stoyan255@yahoo.com>
* Source/GSSlideView.m: (- _slideFrom:to:): Calcuate number of
steps wrt image size.
* Source/GSDragView.m: (- slideDraggedImageTo:): Ditto.
2007-03-08 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSResponder.h: Move _rFlags from here ...

View file

@ -42,6 +42,7 @@
#include "GNUstepGUI/GSDisplayServer.h"
#include "GNUstepGUI/GSDragView.h"
#include <math.h>
/* Size of the dragged window */
#define DWZ 48
@ -271,15 +272,27 @@ static GSDragView *sharedDragView = nil;
- (void) slideDraggedImageTo: (NSPoint)point
{
float distx = point.x - dragPosition.x;
float disty = point.y - dragPosition.y;
float dist = sqrt((distx * distx) + (disty * disty));
NSSize imgSize = [[dragCell image] size];
float imgDist = sqrt((imgSize.width * imgSize.width) +
(imgSize.height * imgSize.height));
int steps = (int)(dist/imgDist);
/*
* Convert point from coordinates of image to coordinates of mouse
* cursor for internal use.
*/
point.x += offset.width;
point.y += offset.height;
[self _slideDraggedImageTo: point
/* [self _slideDraggedImageTo: point
numberOfSteps: SLIDE_NR_OF_STEPS
delay: SLIDE_TIME_STEP
waitAfterSlide: YES];*/
[self _slideDraggedImageTo: point
numberOfSteps: steps
delay: SLIDE_TIME_STEP
waitAfterSlide: YES];
}

View file

@ -70,10 +70,15 @@
float distx = toPoint.x - fromPoint.x;
float disty = toPoint.y - fromPoint.y;
float dist = sqrt((distx * distx) + (disty * disty));
int steps = (int)(dist / MINDIST);
// int steps = (int)(dist / MINDIST);
NSSize imgSize = [[slideCell image] size];
float imgDist = sqrt((imgSize.width * imgSize.width) +
(imgSize.height * imgSize.height));
int steps = (int)(dist/imgDist);
int windowNumber = [_window windowNumber];
GSDisplayServer *server = GSServerForWindow(_window);
if (steps > 2)
{
float unitx = distx / steps;