Subversion Repositories gelsvn

Rev

Rev 656 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 656 Rev 657
Line 45... Line 45...
45
 
45
 
46
// handles resizing of GL need context update and if the window dimensions change, a
46
// handles resizing of GL need context update and if the window dimensions change, a
47
// a window dimension update, reseting of viewport and an update of the projection matrix
47
// a window dimension update, reseting of viewport and an update of the projection matrix
48
- (void) reshape
48
- (void) reshape
49
{
49
{
50
	NSRect rectView = [self bounds];
-
 
51
	me.reshape(rectView.size.width,rectView.size.height);
-
 
52
    NSRect backRect = [self convertRectToBacking:rectView];
50
    NSRect backRect = [self convertRectToBacking:[self bounds]];
53
    glViewport (0, 0, NSWidth(backRect), NSHeight(backRect));
51
    glViewport (0, 0, NSWidth(backRect), NSHeight(backRect));
-
 
52
	me.reshape(NSWidth(backRect),NSHeight(backRect));
54
}
53
}
55
 
54
 
56
// ---------------------------------
55
// ---------------------------------
57
// ---------------------------------
56
// ---------------------------------
58
 
57
 
Line 163... Line 162...
163
        
162
        
164
        NSPoint location = [self convertPoint:[theEvent locationInWindow] fromView:nil];
163
        NSPoint location = [self convertPoint:[theEvent locationInWindow] fromView:nil];
165
        [[self openGLContext] makeCurrentContext];
164
        [[self openGLContext] makeCurrentContext];
166
        Vec2i pos(location.x,location.y);
165
        Vec2i pos(location.x,location.y);
167
        pos *= int([[self window]backingScaleFactor]);
166
        pos *= int([[self window]backingScaleFactor]);
-
 
167
        if([theEvent modifierFlags] & NSShiftKeyMask)
168
        if(!me.grab_mesh(pos))
168
            me.grab_mesh(pos);
-
 
169
        else if([theEvent modifierFlags] & NSControlKeyMask) {
-
 
170
            if(me.select_vertex(pos))
-
 
171
                [self setNeedsDisplay: YES];
-
 
172
        }
-
 
173
        else
169
            me.grab_ball(ROTATE_ACTION,pos);
174
            me.grab_ball(ROTATE_ACTION,pos);
170
	}
175
	}
171
}
176
}
172
 
177
 
173
 
178
 
Line 215... Line 220...
215
- (void)mouseDragged:(NSEvent *)theEvent
220
- (void)mouseDragged:(NSEvent *)theEvent
216
{
221
{
217
	NSPoint location = [self convertPoint:[theEvent locationInWindow] fromView:nil];
222
	NSPoint location = [self convertPoint:[theEvent locationInWindow] fromView:nil];
218
    Vec2i pos(location.x,location.y);
223
    Vec2i pos(location.x,location.y);
219
    pos *= int([[self window]backingScaleFactor]);
224
    pos *= int([[self window]backingScaleFactor]);
-
 
225
//    NSLog(@"Pos <%d %d> ", pos[0], pos[1]);
220
    [[self openGLContext] makeCurrentContext];
226
    [[self openGLContext] makeCurrentContext];
221
    if(!me.drag_mesh(pos))
227
    if(!me.drag_mesh(pos))
222
        me.roll_ball(pos);
228
        me.roll_ball(pos);
223
    [self setNeedsDisplay: YES];
229
    [self setNeedsDisplay: YES];
224
    
230