Doc: update

This commit is contained in:
wanglin2 2023-06-26 16:15:20 +08:00
parent 1b6467728c
commit 98e27841ad
10 changed files with 109 additions and 17 deletions

View File

@ -222,8 +222,12 @@ class View {
}
// 设置缩放
setScale(scale) {
this.scale = scale
setScale(scale, cx, cy) {
if (cx !== undefined && cy !== undefined) {
this.scaleInCenter(cx, cy, scale)
} else {
this.scale = scale
}
this.transform()
this.mindMap.emit('scale', this.scale)
}

View File

@ -53,8 +53,11 @@ class TouchEvent {
let ox = touch1.clientX - touch2.clientX
let oy = touch1.clientY - touch2.clientY
let distance = Math.sqrt(Math.pow(ox, 2) + Math.pow(oy, 2))
let cx = (touch1.clientX + touch2.clientX) / 2
let cy = (touch1.clientY + touch2.clientY) / 2
// 以两指中心点进行缩放
let { x: touch1ClientX, y: touch1ClientY } = this.mindMap.toPos(touch1.clientX, touch1.clientY)
let { x: touch2ClientX, y: touch2ClientY } = this.mindMap.toPos(touch2.clientX, touch2.clientY)
let cx = (touch1ClientX + touch2ClientX) / 2
let cy = (touch1ClientY + touch2ClientY) / 2
if (distance > this.doubleTouchmoveDistance) {
// 放大
this.mindMap.view.enlarge(cx, cy)

View File

@ -1,5 +1,9 @@
# Changelog
## 0.6.4
New: 1.The default is to scale at the center point of the canvas. 2.Optimize the scaling of both fingers on the mobile end, with the center position of the two fingers as the center point for scaling.
## 0.6.3
Fix: 1.Fix the issue where the summary node will respond to inserting node shortcuts.

View File

@ -1,6 +1,8 @@
<template>
<div>
<h1>Changelog</h1>
<h2>0.6.4</h2>
<p>New: 1.The default is to scale at the center point of the canvas. 2.Optimize the scaling of both fingers on the mobile end, with the center position of the two fingers as the center point for scaling.</p>
<h2>0.6.3</h2>
<p>Fix: 1.Fix the issue where the summary node will respond to inserting node shortcuts.</p>
<p>New: 1.Support custom node content.</p>

View File

@ -35,11 +35,19 @@ Translate the `y` direction to a specific position
Revert to the default transformation
### narrow()
### narrow(cx, cy)
- `cx`:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas
- `cy`:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas
Zoom out
### enlarge()
### enlarge(cx, cy)
- `cx`:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas
- `cy`:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas
Zoom in
@ -56,8 +64,12 @@ Get the current transform data, can be used for display
Dynamically set transform data, transform data can be obtained through the
getTransformData method"
### setScale(scale)
### setScale(scale, cx, cy)
> v0.2.17+
- `cx`:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas
- `cy`:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas
Setting Zoom

View File

@ -25,9 +25,25 @@ through <code>mindMap.view</code></p>
<p>Translate the <code>y</code> direction to a specific position</p>
<h3>reset()</h3>
<p>Revert to the default transformation</p>
<h3>narrow()</h3>
<h3>narrow(cx, cy)</h3>
<ul>
<li>
<p><code>cx</code>:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas</p>
</li>
<li>
<p><code>cy</code>:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas</p>
</li>
</ul>
<p>Zoom out</p>
<h3>enlarge()</h3>
<h3>enlarge(cx, cy)</h3>
<ul>
<li>
<p><code>cx</code>:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas</p>
</li>
<li>
<p><code>cy</code>:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas</p>
</li>
</ul>
<p>Zoom in</p>
<h3>getTransformData()</h3>
<blockquote>
@ -40,10 +56,18 @@ through <code>mindMap.view</code></p>
</blockquote>
<p>Dynamically set transform data, transform data can be obtained through the
getTransformData method&quot;</p>
<h3>setScale(scale)</h3>
<h3>setScale(scale, cx, cy)</h3>
<blockquote>
<p>v0.2.17+</p>
</blockquote>
<ul>
<li>
<p><code>cx</code>:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas</p>
</li>
<li>
<p><code>cy</code>:v0.6.4+Zoom to the specified position on the canvas, default to the center point of the canvas</p>
</li>
</ul>
<p>Setting Zoom</p>
</div>

View File

@ -1,5 +1,9 @@
# Changelog
## 0.6.4
新增1.默认以画布中心点进行缩放。 2.优化移动端双指缩放,以双指中心位置为中心点进行缩放。
## 0.6.3
修复1.修复概要节点会响应插入节点快捷键的问题。

View File

@ -1,6 +1,8 @@
<template>
<div>
<h1>Changelog</h1>
<h2>0.6.4</h2>
<p>新增1.默认以画布中心点进行缩放 2.优化移动端双指缩放以双指中心位置为中心点进行缩放</p>
<h2>0.6.3</h2>
<p>修复1.修复概要节点会响应插入节点快捷键的问题</p>
<p>新增1.支持自定义节点内容</p>

View File

@ -34,11 +34,19 @@
恢复到默认的变换
### narrow()
### narrow(cx, cy)
- `cx`v0.6.4+)以画布指定位置进行缩放,默认为画布中心点
- `cy`v0.6.4+)以画布指定位置进行缩放,默认为画布中心点
缩小
### enlarge()
### enlarge(cx, cy)
- `cx`v0.6.4+)以画布指定位置进行缩放,默认为画布中心点
- `cy`v0.6.4+)以画布指定位置进行缩放,默认为画布中心点
放大
@ -54,8 +62,13 @@
动态设置变换数据可以通过getTransformData方法获取变换数据
### setScale(scale)
### setScale(scale, cx, cy)
> v0.2.17+
设置缩放
- `cx`v0.6.4+)以画布指定位置进行缩放,默认为画布中心点
- `cy`v0.6.4+)以画布指定位置进行缩放,默认为画布中心点
设置缩放

View File

@ -24,9 +24,25 @@
<p>平移<code>y</code>方向到指定位置</p>
<h3>reset()</h3>
<p>恢复到默认的变换</p>
<h3>narrow()</h3>
<h3>narrow(cx, cy)</h3>
<ul>
<li>
<p><code>cx</code>v0.6.4+以画布指定位置进行缩放默认为画布中心点</p>
</li>
<li>
<p><code>cy</code>v0.6.4+以画布指定位置进行缩放默认为画布中心点</p>
</li>
</ul>
<p>缩小</p>
<h3>enlarge()</h3>
<h3>enlarge(cx, cy)</h3>
<ul>
<li>
<p><code>cx</code>v0.6.4+以画布指定位置进行缩放默认为画布中心点</p>
</li>
<li>
<p><code>cy</code>v0.6.4+以画布指定位置进行缩放默认为画布中心点</p>
</li>
</ul>
<p>放大</p>
<h3>getTransformData()</h3>
<blockquote>
@ -38,10 +54,18 @@
<p>v0.1.1+</p>
</blockquote>
<p>动态设置变换数据可以通过getTransformData方法获取变换数据</p>
<h3>setScale(scale)</h3>
<h3>setScale(scale, cx, cy)</h3>
<blockquote>
<p>v0.2.17+</p>
</blockquote>
<ul>
<li>
<p><code>cx</code>v0.6.4+以画布指定位置进行缩放默认为画布中心点</p>
</li>
<li>
<p><code>cy</code>v0.6.4+以画布指定位置进行缩放默认为画布中心点</p>
</li>
</ul>
<p>设置缩放</p>
</div>