手帳「アクションプランナー」風のオリジナルアプリ「APCDigital」開発その12
手帳「アクションプランナー」風のオリジナルアプリ「APCDigital」開発
背景は以前の記事
「手帳「アクションプランナー」→「Planner」、最終的にはオリジナルへ」
GitHub
iPad Pro 12.9インチ専用です。
位置指定を変更(調整)すれば他のサイズでも使えますが。
https://github.com/cloudsquare22/APCDigital
細い線を試す、標準最小値より細い文字を書く!!
Apple Pencilの移動を拾って描画する
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
if let touch = touches.first {
print("touchesMoved: \(touch.precisePreviousLocation(in: self)) - \(touch.preciseLocation(in: self))")
let startPoint = PKStrokePoint(location: touch.precisePreviousLocation(in: self), timeOffset: 0, size: CGSize(width: 2.3, height: 2.3), opacity: 2, force: 0, azimuth: 0, altitude: 0)
let endPoint = PKStrokePoint(location: touch.preciseLocation(in: self), timeOffset: 0, size: CGSize(width: 2.3, height: 2.3), opacity: 2, force: 0, azimuth: 0, altitude: 0)
let ink = PKInk(.pen, color: .blue)
let path = PKStrokePath(controlPoints: [startPoint, endPoint], creationDate: Date())
let stroke = PKStroke(ink: ink, path: path)
if self.onMarker == true {
self.drawing.strokes.append(stroke)
}
print(self.drawing.strokes.count)
}
}



