단순히 UseCase가 변화량만을 가지고 하는것은 불가능하고 또 이상함
UseCase는 값을 받아서 넣어주기만해야한다. 어떤 특정 이벤트로 어떤 특정값이 들어오게 하는것보단 일반적인 값이들어오게 하는것이 맞다.
var scale: CGFloat = 0
var savedScale: CGFloat = 0.5
var deltaAngle: Float = 0
var initialDistance: CGFloat = 0
var initialAngle: CGFloat = 0
func componentControlDidRotateAndScale(_ componentControl: ComponentControl, with gesture: UIGestureRecognizer) {
let touchLocation = gesture.location(in: self.view)
let center = self.testLabel.center
let xDifference = (center.x - touchLocation.x)
let yDifference = (center.y - touchLocation.y)
let distance = sqrt(xDifference * xDifference + yDifference * yDifference)
let angle = atan2f(Float(touchLocation.y - center.y), Float(touchLocation.x - center.x))
switch gesture.state {
case .began:
self.deltaAngle = angle - atan2f(Float(self.testLabel.transform.b), Float(self.testLabel.transform.a))
self.initialDistance = distance
case .changed:
let angleDiff = Float(self.deltaAngle) - angle
scale = distance / self.initialDistance
scale *= savedScale
// viewModel.changeSelectedSclae(scale)
// viewModel.changeSelectedRotation(angle) -> usecase에서 실제 컴포넌트에 적용 -> 타고타고내려와서 bind걸린곳에서 실제처리
// var transform = CGAffineTransform.identity
// transform = transform.rotated(by: CGFloat(-angleDiff))
// transform = transform.scaledBy(x: scale, y: scale)
// self.testLabel.transform = transform
// control.transform = testLabel.transform
// control.layer.borderWidth = 2 / scale
case .ended:
savedScale = scale
default:
break
}
}
업다운게임에서 테스트한 코드
깐부 연결
연결되면 편집화면
사진 편집해서 올리기
*
올라온 사진 선택해서 옮기거나 각도조절, 인덱스 조절 가능
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing