Skip to content

Commit

Permalink
chore: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ourongxing committed Sep 9, 2023
1 parent c4954cf commit 2fe47c1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 38 deletions.
3 changes: 1 addition & 2 deletions packages/docs/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ https://bbs.marginnote.cn/t/topic/20501#heading-6
:::
## v4.3.2 (2023-09-05)
### 优化
- `Gesture`: 优化手势识别的响应率。移除手动调节识别区域的功能,因为我意识到可能是有人压根不知道哪个是文字选择工具栏,不是点击已经摘录的文字出现的工具栏。
- `Gesture`: 优化手势识别的响应率。移除手动调节识别区域的功能,因为我意识到可能是有人压根就不知道哪个是文字选择工具栏,不是点击已经摘录的文字出现的工具栏。
- `Toolbar`: 优化工具栏的显示位置,尤其是当父卡片为框架的时候。


## v4.3.1 (2023-09-04)
### 新功能
- 新模块:**Toolbar**,点击卡片或者选中文字时添加动作工具栏,点击执行动作。
Expand Down
73 changes: 39 additions & 34 deletions packages/ohmymn/src/jsExtension/handleGestureEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,7 @@ import { ensureSafety, resizeSettingViewView } from "./switchPanel"
// Not support Mac
// Cannot access self unless use function
export const gestureRecognizers = () => {
return gestureRecognizerController([
{
view: MN.studyController.view,
gesture: initGesture.swipe(
1,
UISwipeGestureRecognizerDirection.Up,
"onSwipeUpOnMindMapView"
)
},
{
view: MN.studyController.view,
gesture: initGesture.swipe(
1,
UISwipeGestureRecognizerDirection.Down,
"onSwipeDownOnMindMapView"
)
},
{
view: MN.studyController.view,
gesture: initGesture.swipe(
1,
UISwipeGestureRecognizerDirection.Left,
"onSwipeLeftOnMindMapView"
)
},
{
view: MN.studyController.view,
gesture: initGesture.swipe(
1,
UISwipeGestureRecognizerDirection.Right,
"onSwipeRightOnMindMapView"
)
},
const gestures = [
{
view: self.dragOverlayView,
gesture: initGesture.pan("onDnd")
Expand All @@ -54,7 +22,44 @@ export const gestureRecognizers = () => {
view: self.stretchOverlayView,
gesture: initGesture.pan("onStretch")
}
])
]
if (!MN.isMac) {
gestures.push(
{
view: MN.studyController.view,
gesture: initGesture.swipe(
1,
UISwipeGestureRecognizerDirection.Up,
"onSwipeUpOnMindMapView"
)
},
{
view: MN.studyController.view,
gesture: initGesture.swipe(
1,
UISwipeGestureRecognizerDirection.Down,
"onSwipeDownOnMindMapView"
)
},
{
view: MN.studyController.view,
gesture: initGesture.swipe(
1,
UISwipeGestureRecognizerDirection.Left,
"onSwipeLeftOnMindMapView"
)
},
{
view: MN.studyController.view,
gesture: initGesture.swipe(
1,
UISwipeGestureRecognizerDirection.Right,
"onSwipeRightOnMindMapView"
)
}
)
}
return gestureRecognizerController(gestures)
}

export default defineGestureHandlers({
Expand Down
2 changes: 1 addition & 1 deletion packages/ohmymn/src/modules/toolbar/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export function actionBarView(type: "card" | "text") {
length: buttonNum
}
}
const { width: MNWidth } = MN.studyController.view.bounds

return {
view,
Expand All @@ -130,6 +129,7 @@ export function actionBarView(type: "card" | "text") {
? view.frame.x + view.frame.width / 2 - width / 2 + gap / 2
: view.frame.x - width / 2 + gap / 2
if (x < 30) return 30
const { width: MNWidth } = MN.studyController.view.bounds
if (x > MNWidth - 30 - width) return MNWidth - 30 - width
return x
})()
Expand Down
1 change: 0 additions & 1 deletion packages/ohmymn/src/profile/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const defaultGlobalProfile = {
noteOptions: []
},
gesture: {
showY: false,
singleBarSwipeUpShortcut: "",
singleBarSwipeDownShortcut: "",
singleBarSwipeRightShortcut: "",
Expand Down

0 comments on commit 2fe47c1

Please sign in to comment.