-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
single node movements #46
base: master
Are you sure you want to change the base?
Conversation
* Convert `texture` property to optional * Add `init` func default value for image parameter * Set `texture` nil when image is nil
* - Reconfig physics of Magnetic when size is changed (efremidze#15) * Update Magnetic.swift
('characters' is deprecated: Please use String or Substring directly)
Found an issue while trying to select a node on an iPad. Looking into it now. |
K fixed |
Going to take a look at the codebeat thing tomorrow |
This will help the node stay under the user's finger when the physics strength is higher.
Don't worry about Codebeat, Ill review the PR later today |
/** | ||
Lets the user move all of the nodes at once. On by default. | ||
**/ | ||
open var allowAllNodeMovement: Bool = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't allowSingleNodeMovement and allowAllNodeMovement mutually exclusive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sources/Magnetic.swift
Outdated
movingNodeTimer?.invalidate() | ||
movingNodeTimer = nil | ||
} | ||
movingNodeTimer = Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(self.moveNode(timer:)), userInfo: ["touchLocation":touchLocation, "node": node], repeats: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the Timer block function
https://developer.apple.com/documentation/foundation/timer/2091889-scheduledtimer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to but it seems to only be available in iOS 10 or later.
Sources/Magnetic.swift
Outdated
var movingNode: SKNode? = nil | ||
var initialTouchLocation: CGPoint? = nil | ||
var initialTouchStartedOnNode: Bool = false | ||
var movingNodeTimer: Timer? = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use a state machine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats a state machine? Got any good examples?
@efremidze I am still making some tweaks fyi. I will give you a heads up when its more finalized. |
get rid of isDragging in lieu of the distance of the initial touch location extract moveAllNodes, node at point and moveNode rename keepNodeStill move all the things
@efremidze I am feeling better about the pr now. Feel free to check out the new changes at your convenience. |
Ill review it this week. I might want to make some changes. |
I'll try to include this asap |
Woot. Thank you. Now that xcode 9.3 is out let me know if you want me to resolve the conflicts first. |
Hello guys, |
Checklist
Motivation and Context
I wanted to allow the user to move an individual node.
Description
Allows for single node movements. Also exposed a field for making it easier to select a node:
nodeSelectionForgivenessDistance
.