//
//  GSHobbyKnob.h
//  GlyphsCore
//
//  Created by Florian Pircher on 05.08.22.
//  Copyright © 2022 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSElement.h>
#import <GlyphsCore/GSSelectableElementProtocol.h>
#import <GlyphsCore/GSHobbySplines.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(uint8_t, GSHobbyKnobType) {
	GSHobbyKnobTypeBoth,
	GSHobbyKnobTypeLeading,
	GSHobbyKnobTypeTrailing,
};

@interface GSHobbyKnob : NSObject <GSSelectableElementProtocol>

@property (weak, nullable) GSContainer *parent;
@property (assign) GSHobbyKnobType type;
@property (strong) GSHobbyKnot *knot;
/// The virtual position may be different to the visual `position` if the two handles of a Hobby knot have a different angle or tension. Use `position` for mouse pointer interactions and `virtualPosition` for node–knob distance calculations.
@property (assign, readonly) NSPoint virtualPosition;
@property (strong) GSHobbyNodeInfo *info;

- (instancetype)initWithType:(GSHobbyKnobType)type
					 forKnot:(GSHobbyKnot *)knot
				  atPosition:(NSPoint)position
			 virtualPosition:(NSPoint)virtualPosition
					withInfo:(GSHobbyNodeInfo *)info
					inParent:(GSContainer *)parent;
@end

NS_ASSUME_NONNULL_END
