Compare commits
18 Commits
@antv/x6@1
...
@antv/x6@1
Author | SHA1 | Date | |
---|---|---|---|
da41870afd | |||
db0c31deb0 | |||
a7720251ff | |||
1d64eb7673 | |||
4ebad79e25 | |||
322128bd8f | |||
0ce74d2df1 | |||
ab5d1c7c81 | |||
186e530480 | |||
a486446015 | |||
77d8a88878 | |||
4a89c2b82e | |||
f6d936e4a2 | |||
dfde26b305 | |||
750242ce92 | |||
b884b795a9 | |||
fad7bec85c | |||
7392a48585 |
@ -1,3 +1,15 @@
|
||||
## @antv/x6-common [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-common@1.0.0...@antv/x6-common@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
# @antv/x6-common 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-common",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Basic toolkit for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -6,4 +6,5 @@ export {
|
||||
sortBy,
|
||||
groupBy,
|
||||
difference,
|
||||
max
|
||||
} from 'lodash-es'
|
||||
|
@ -1,7 +1,12 @@
|
||||
import { ns } from './elem'
|
||||
import { kebabCase } from '../string/format'
|
||||
|
||||
const CASE_SENSITIVE_ATTR = ['viewBox']
|
||||
export const CASE_SENSITIVE_ATTR = [
|
||||
'viewBox',
|
||||
'attributeName',
|
||||
'attributeType',
|
||||
'repeatCount',
|
||||
]
|
||||
|
||||
export type Attributes = { [key: string]: string | number | null | undefined }
|
||||
|
||||
|
@ -1,56 +1,70 @@
|
||||
const ua = navigator.userAgent
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
let _IS_MAC = false
|
||||
let _IS_IOS = false
|
||||
let _IS_WINDOWS = false
|
||||
let _IS_IE = false
|
||||
let _IS_IE11 = false
|
||||
let _IS_EDGE = false
|
||||
let _IS_NETSCAPE = false
|
||||
let _IS_CHROME_APP = false
|
||||
let _IS_CHROME = false
|
||||
let _IS_OPERA = false
|
||||
let _IS_FIREFOX = false
|
||||
let _IS_SAFARI = false
|
||||
let _SUPPORT_TOUCH = false
|
||||
let _SUPPORT_POINTER = false
|
||||
let _SUPPORT_PASSIVE = false
|
||||
let _NO_FOREIGNOBJECT = false
|
||||
|
||||
export namespace Platform {
|
||||
export const IS_MAC = ua.indexOf('Macintosh') > 0
|
||||
export const IS_IOS = !!ua.match(/(iPad|iPhone|iPod)/g)
|
||||
export const IS_WINDOWS = ua.indexOf('Windows') > 0
|
||||
if (typeof navigator === 'object') {
|
||||
const ua = navigator.userAgent
|
||||
_IS_MAC = ua.indexOf('Macintosh') >= 0
|
||||
_IS_IOS = !!ua.match(/(iPad|iPhone|iPod)/g)
|
||||
_IS_WINDOWS = ua.indexOf('Windows') >= 0
|
||||
|
||||
export const IS_IE = ua.indexOf('MSIE') >= 0
|
||||
export const IS_IE11 = !!ua.match(/Trident\/7\./)
|
||||
export const IS_EDGE = !!ua.match(/Edge\//)
|
||||
_IS_IE = ua.indexOf('MSIE') >= 0
|
||||
_IS_IE11 = !!ua.match(/Trident\/7\./)
|
||||
_IS_EDGE = !!ua.match(/Edge\//)
|
||||
|
||||
/**
|
||||
* A flag indicating whether the browser is Netscape (including Firefox).
|
||||
*/
|
||||
export const IS_NETSCAPE =
|
||||
_IS_NETSCAPE =
|
||||
ua.indexOf('Mozilla/') >= 0 &&
|
||||
ua.indexOf('MSIE') < 0 &&
|
||||
ua.indexOf('Edge/') < 0
|
||||
|
||||
/**
|
||||
* A flag indicating whether the the this is running inside a Chrome App.
|
||||
*/
|
||||
export const IS_CHROME_APP =
|
||||
(window as any).chrome != null &&
|
||||
(window as any).chrome.app != null &&
|
||||
(window as any).chrome.app.runtime != null
|
||||
|
||||
export const IS_CHROME = ua.indexOf('Chrome/') >= 0 && ua.indexOf('Edge/') < 0
|
||||
export const IS_OPERA = ua.indexOf('Opera/') >= 0 || ua.indexOf('OPR/') >= 0
|
||||
export const IS_FIREFOX = ua.indexOf('Firefox/') >= 0
|
||||
export const IS_SAFARI =
|
||||
_IS_CHROME = ua.indexOf('Chrome/') >= 0 && ua.indexOf('Edge/') < 0
|
||||
_IS_OPERA = ua.indexOf('Opera/') >= 0 || ua.indexOf('OPR/') >= 0
|
||||
_IS_FIREFOX = ua.indexOf('Firefox/') >= 0
|
||||
_IS_SAFARI =
|
||||
ua.indexOf('AppleWebKit/') >= 0 &&
|
||||
ua.indexOf('Chrome/') < 0 &&
|
||||
ua.indexOf('Edge/') < 0
|
||||
|
||||
/**
|
||||
* A flag indicating whether this device supports touchstart/-move/-end
|
||||
* events (Apple iOS, Android, Chromebook and Chrome Browser on touch-enabled
|
||||
* devices).
|
||||
*/
|
||||
export const SUPPORT_TOUCH = 'ontouchstart' in document.documentElement
|
||||
if (typeof document === 'object') {
|
||||
_NO_FOREIGNOBJECT =
|
||||
!document.createElementNS ||
|
||||
`${document.createElementNS(
|
||||
'http://www.w3.org/2000/svg',
|
||||
'foreignObject',
|
||||
)}` !== '[object SVGForeignObjectElement]' ||
|
||||
ua.indexOf('Opera/') >= 0
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether this device supports Microsoft pointer events.
|
||||
*/
|
||||
export const SUPPORT_POINTER = (window as any).PointerEvent != null && !IS_MAC
|
||||
if (typeof window === 'object') {
|
||||
_IS_CHROME_APP =
|
||||
(window as any).chrome != null &&
|
||||
(window as any).chrome.app != null &&
|
||||
(window as any).chrome.app.runtime != null
|
||||
_SUPPORT_POINTER = (window as any).PointerEvent != null && !_IS_MAC
|
||||
}
|
||||
|
||||
export let SUPPORT_PASSIVE = false // eslint-disable-line import/no-mutable-exports
|
||||
if (typeof document === 'object') {
|
||||
_SUPPORT_TOUCH = 'ontouchstart' in document.documentElement
|
||||
|
||||
try {
|
||||
const options = Object.defineProperty({}, 'passive', {
|
||||
get() {
|
||||
SUPPORT_PASSIVE = true
|
||||
_SUPPORT_PASSIVE = true
|
||||
},
|
||||
})
|
||||
const div = document.createElement('div')
|
||||
@ -60,18 +74,50 @@ export namespace Platform {
|
||||
} catch (err) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
export namespace Platform {
|
||||
export const IS_MAC = _IS_MAC
|
||||
export const IS_IOS = _IS_IOS
|
||||
export const IS_WINDOWS = _IS_WINDOWS
|
||||
|
||||
export const IS_IE = _IS_IE
|
||||
export const IS_IE11 = _IS_IE11
|
||||
export const IS_EDGE = _IS_EDGE
|
||||
|
||||
/**
|
||||
* A flag indicating whether the browser is Netscape (including Firefox).
|
||||
*/
|
||||
export const IS_NETSCAPE = _IS_NETSCAPE
|
||||
|
||||
/**
|
||||
* A flag indicating whether the the this is running inside a Chrome App.
|
||||
*/
|
||||
export const IS_CHROME_APP = _IS_CHROME_APP
|
||||
|
||||
export const IS_CHROME = _IS_CHROME
|
||||
export const IS_OPERA = _IS_OPERA
|
||||
export const IS_FIREFOX = _IS_FIREFOX
|
||||
export const IS_SAFARI = _IS_SAFARI
|
||||
|
||||
/**
|
||||
* A flag indicating whether this device supports touchstart/-move/-end
|
||||
* events (Apple iOS, Android, Chromebook and Chrome Browser on touch-enabled
|
||||
* devices).
|
||||
*/
|
||||
export const SUPPORT_TOUCH = _SUPPORT_TOUCH
|
||||
|
||||
/**
|
||||
* A flag indicating whether this device supports Microsoft pointer events.
|
||||
*/
|
||||
export const SUPPORT_POINTER = _SUPPORT_POINTER
|
||||
|
||||
export const SUPPORT_PASSIVE = _SUPPORT_PASSIVE
|
||||
|
||||
/**
|
||||
* A flag indicating whether foreignObject support is not available. This
|
||||
* is the case for Opera, older SVG-based browsers and all versions of IE.
|
||||
*/
|
||||
export const NO_FOREIGNOBJECT =
|
||||
!document.createElementNS ||
|
||||
`${document.createElementNS(
|
||||
'http://www.w3.org/2000/svg',
|
||||
'foreignObject',
|
||||
)}` !== '[object SVGForeignObjectElement]' ||
|
||||
ua.indexOf('Opera/') >= 0
|
||||
export const NO_FOREIGNOBJECT = _NO_FOREIGNOBJECT
|
||||
|
||||
export const SUPPORT_FOREIGNOBJECT = !NO_FOREIGNOBJECT
|
||||
}
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-plugin-clipboard [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-clipboard@1.0.0...@antv/x6-plugin-clipboard@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-clipboard 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-clipboard",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "clipboard plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -37,10 +37,10 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -1,3 +1,33 @@
|
||||
## @antv/x6-plugin-dnd [1.0.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-dnd@1.0.1...@antv/x6-plugin-dnd@1.0.2) (2022-11-05)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.1.0
|
||||
|
||||
## @antv/x6-plugin-dnd [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-dnd@1.0.0...@antv/x6-plugin-dnd@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-dnd 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-dnd",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.2",
|
||||
"description": "dnd plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -38,10 +38,10 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x"
|
||||
"@antv/x6": "1.1.0"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-plugin-export [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-export@1.0.0...@antv/x6-plugin-export@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-export 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-export",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "export plugin for X6.",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -36,10 +36,10 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-plugin-history [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-history@1.0.0...@antv/x6-plugin-history@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-history 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-history",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "history plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -37,10 +37,10 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-plugin-keyboard [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-keyboard@1.0.0...@antv/x6-plugin-keyboard@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-keyboard 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-keyboard",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "keyboard plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -40,10 +40,10 @@
|
||||
"mousetrap": "^1.6.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x",
|
||||
"@antv/x6": "1.0.1",
|
||||
"@types/mousetrap": "^1.6.5"
|
||||
},
|
||||
"author": {
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-plugin-minimap [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-minimap@1.0.0...@antv/x6-plugin-minimap@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-minimap 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-minimap",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "minimap plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -37,10 +37,10 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-plugin-scroller [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-scroller@1.0.0...@antv/x6-plugin-scroller@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-scroller 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-scroller",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "scroller plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -37,10 +37,10 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -305,6 +305,11 @@ export class ScrollerImpl extends View<ScrollerImpl.EventArgs> {
|
||||
const graphHeight = this.graph.options.height
|
||||
const pageWidth = this.options.pageWidth! * this.sx
|
||||
const pageHeight = this.options.pageHeight! * this.sy
|
||||
|
||||
if (pageWidth === 0 || pageHeight === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
if (graphWidth > pageWidth || graphHeight > pageHeight) {
|
||||
let hasPageBreak = false
|
||||
const container = document.createElement('div')
|
||||
@ -1140,15 +1145,11 @@ export namespace ScrollerImpl {
|
||||
| NumberExt.SideOptions
|
||||
| ((this: ScrollerImpl, scroller: ScrollerImpl) => NumberExt.SideOptions)
|
||||
autoResizeOptions?:
|
||||
| (TransformManager.FitToContentFullOptions & {
|
||||
direction: AutoResizeDirection | AutoResizeDirection[]
|
||||
})
|
||||
| TransformManager.FitToContentFullOptions
|
||||
| ((
|
||||
this: ScrollerImpl,
|
||||
scroller: ScrollerImpl,
|
||||
) => TransformManager.FitToContentFullOptions & {
|
||||
direction: AutoResizeDirection | AutoResizeDirection[]
|
||||
})
|
||||
) => TransformManager.FitToContentFullOptions)
|
||||
}
|
||||
|
||||
export interface Options extends CommonOptions {
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-plugin-selection [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-selection@1.0.0...@antv/x6-plugin-selection@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-selection 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-selection",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "selection plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -37,10 +37,10 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-plugin-snapline [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-snapline@1.0.0...@antv/x6-plugin-snapline@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-snapline 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-snapline",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "snapline plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -37,10 +37,10 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -1,3 +1,24 @@
|
||||
## @antv/x6-plugin-stencil [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-stencil@1.0.0...@antv/x6-plugin-stencil@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
* **@antv/x6-plugin-dnd:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-stencil 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-stencil",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "stencil plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -37,12 +37,12 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x",
|
||||
"@antv/x6-plugin-dnd": "^2.x"
|
||||
"@antv/x6": "1.0.1",
|
||||
"@antv/x6-plugin-dnd": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x",
|
||||
"@antv/x6-plugin-dnd": "^2.0.x"
|
||||
"@antv/x6": "1.0.1",
|
||||
"@antv/x6-plugin-dnd": "1.0.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-plugin-transform [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-transform@1.0.0...@antv/x6-plugin-transform@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-plugin-transform 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-transform",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "transform plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -37,10 +37,10 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x"
|
||||
"@antv/x6": "1.0.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "bubkoo",
|
||||
|
@ -1,3 +1,15 @@
|
||||
## @antv/x6-react-components [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-react-components@1.0.0...@antv/x6-react-components@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
# @antv/x6-react-components 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-react-components",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "React components for building x6 editors",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -58,7 +58,7 @@
|
||||
"rc-dropdown": "^3.0.0-alpha.0",
|
||||
"rc-util": "^4.15.7",
|
||||
"react-color": "2.17.1",
|
||||
"react-resize-detector": "^6.6.4",
|
||||
"react-resize-detector": "^7.0.0",
|
||||
"ua-parser-js": "^0.7.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -67,7 +67,7 @@
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"@types/react-color": "^3.0.1",
|
||||
"@types/react-resize-detector": "^5.0.0",
|
||||
"@types/react-resize-detector": "^6.0.0",
|
||||
"@types/ua-parser-js": "^0.7.33",
|
||||
"antd": "^4.4.2"
|
||||
},
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-react-shape [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-react-shape@1.0.0...@antv/x6-react-shape@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-react-shape 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-react-shape",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "X6 shape for rendering react components.",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -38,12 +38,12 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x",
|
||||
"@antv/x6": "1.0.1",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x",
|
||||
"@antv/x6": "1.0.1",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/react-dom": "^18.0.0",
|
||||
"react": "^18.0.0",
|
||||
|
@ -1,3 +1,23 @@
|
||||
## @antv/x6-vue-shape [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-vue-shape@1.0.0...@antv/x6-vue-shape@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* bump to 2.0 ([04cd9de](https://github.com/antvis/x6/commit/04cd9de505bd92a70f33dbc0cfc75b4f9b8126c1))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* bump to 2.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6:** upgraded to 1.0.1
|
||||
|
||||
# @antv/x6-vue-shape 1.0.0 (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-vue-shape",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "X6 shape for rendering vue components.",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -38,7 +38,7 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue-demi": "^0.7.4"
|
||||
"vue-demi": "latest"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@vue/composition-api": {
|
||||
@ -46,12 +46,12 @@
|
||||
}
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x",
|
||||
"@antv/x6": "1.0.1",
|
||||
"@vue/composition-api": "^1.0.0-rc.6",
|
||||
"vue": "^2.6.12 || ^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.0.x",
|
||||
"@antv/x6": "1.0.1",
|
||||
"@vue/composition-api": "^1.0.0-rc.6",
|
||||
"vue": "^2.6.12"
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { NodeView } from '@antv/x6'
|
||||
import { NodeView, Dom } from '@antv/x6'
|
||||
import { isVue2, isVue3, createApp, h, Vue2 } from 'vue-demi'
|
||||
import { VueShape } from './node'
|
||||
import { shapeMaps } from './registry'
|
||||
@ -71,6 +71,30 @@ export class VueShapeView extends NodeView<VueShape> {
|
||||
return root
|
||||
}
|
||||
|
||||
onMouseDown(e: Dom.MouseDownEvent, x: number, y: number) {
|
||||
const target = e.target as Element
|
||||
const tagName = target.tagName.toLowerCase()
|
||||
if (tagName === 'input') {
|
||||
const type = target.getAttribute('type')
|
||||
if (
|
||||
type == null ||
|
||||
[
|
||||
'text',
|
||||
'password',
|
||||
'number',
|
||||
'email',
|
||||
'search',
|
||||
'tel',
|
||||
'url',
|
||||
].includes(type)
|
||||
) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
super.onMouseDown(e, x, y)
|
||||
}
|
||||
|
||||
unmount() {
|
||||
if (isActive()) {
|
||||
disconnect(this.cell.id)
|
||||
|
@ -1,3 +1,18 @@
|
||||
# @antv/x6 [1.1.0](https://github.com/antvis/x6/compare/@antv/x6@1.0.1...@antv/x6@1.1.0) (2022-11-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* sync some commit from v1 ([#2851](https://github.com/antvis/x6/issues/2851)) ([a772025](https://github.com/antvis/x6/commit/a7720251ff42f2892bff9c3cd5159932322362b1))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
* **@antv/x6-common:** upgraded to 1.1.0
|
||||
|
||||
## @antv/x6 [1.0.1](https://github.com/antvis/x6/compare/@antv/x6@1.0.0...@antv/x6@1.0.1) (2022-11-05)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6",
|
||||
"version": "1.0.1",
|
||||
"version": "1.1.0",
|
||||
"description": "JavaScript diagramming library that uses SVG and HTML for rendering",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -44,7 +44,7 @@
|
||||
"pretest": "rss"
|
||||
},
|
||||
"dependencies": {
|
||||
"@antv/x6-common": "1.0.1",
|
||||
"@antv/x6-common": "1.1.0",
|
||||
"@antv/x6-geometry": "1.0.1",
|
||||
"utility-types": "^3.10.0"
|
||||
},
|
||||
|
@ -113,27 +113,14 @@ export class MouseWheel extends Base {
|
||||
targetScale = NumberExt.clamp(targetScale, minScale, maxScale)
|
||||
|
||||
if (targetScale !== currentScale) {
|
||||
const scroller = this.graph.getPlugin<any>('scroller')
|
||||
if (scroller) {
|
||||
if (this.widgetOptions.zoomAtMousePosition) {
|
||||
const origin = this.graph.coord.clientToLocalPoint(this.startPos)
|
||||
scroller.zoom(targetScale, {
|
||||
absolute: true,
|
||||
center: origin.clone(),
|
||||
})
|
||||
} else {
|
||||
scroller.zoom(targetScale, { absolute: true })
|
||||
}
|
||||
if (this.widgetOptions.zoomAtMousePosition) {
|
||||
const origin = this.graph.coord.clientToLocalPoint(this.startPos)
|
||||
this.graph.zoom(targetScale, {
|
||||
absolute: true,
|
||||
center: origin.clone(),
|
||||
})
|
||||
} else {
|
||||
if (this.widgetOptions.zoomAtMousePosition) {
|
||||
const origin = this.graph.coord.clientToGraphPoint(this.startPos)
|
||||
this.graph.zoom(targetScale, {
|
||||
absolute: true,
|
||||
center: origin.clone(),
|
||||
})
|
||||
} else {
|
||||
this.graph.zoom(targetScale, { absolute: true })
|
||||
}
|
||||
this.graph.zoom(targetScale, { absolute: true })
|
||||
}
|
||||
}
|
||||
this.currentScale = null
|
||||
|
@ -41,7 +41,9 @@ export namespace Options {
|
||||
clickThreshold: number
|
||||
magnetThreshold: number | 'onleave'
|
||||
preventDefaultDblClick: boolean
|
||||
preventDefaultContextMenu: boolean
|
||||
preventDefaultContextMenu:
|
||||
| boolean
|
||||
| ((this: Graph, { view }: { view: CellView | null }) => boolean)
|
||||
preventDefaultMouseDown: boolean
|
||||
preventDefaultBlankAction: boolean
|
||||
interacting: CellView.Interacting
|
||||
|
@ -133,13 +133,27 @@ export class GraphView extends View {
|
||||
}
|
||||
}
|
||||
|
||||
protected isPreventDefaultContextMenu(view: CellView | null) {
|
||||
let preventDefaultContextMenu = this.options.preventDefaultContextMenu
|
||||
if (typeof preventDefaultContextMenu === 'function') {
|
||||
preventDefaultContextMenu = FunctionExt.call(
|
||||
preventDefaultContextMenu,
|
||||
this.graph,
|
||||
{ view },
|
||||
)
|
||||
}
|
||||
|
||||
return preventDefaultContextMenu
|
||||
}
|
||||
|
||||
protected onContextMenu(evt: Dom.ContextMenuEvent) {
|
||||
if (this.options.preventDefaultContextMenu) {
|
||||
const e = this.normalizeEvent(evt)
|
||||
const view = this.findView(e.target)
|
||||
|
||||
if (this.isPreventDefaultContextMenu(view)) {
|
||||
evt.preventDefault()
|
||||
}
|
||||
|
||||
const e = this.normalizeEvent(evt)
|
||||
const view = this.findView(e.target)
|
||||
if (this.guard(e, view)) {
|
||||
return
|
||||
}
|
||||
@ -195,7 +209,10 @@ export class GraphView extends View {
|
||||
if (view) {
|
||||
view.onMouseDown(e, localPoint.x, localPoint.y)
|
||||
} else {
|
||||
if (this.options.preventDefaultBlankAction) {
|
||||
if (
|
||||
this.options.preventDefaultBlankAction &&
|
||||
['touchstart'].includes(e.type)
|
||||
) {
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
@ -460,9 +477,11 @@ export class GraphView extends View {
|
||||
}
|
||||
|
||||
protected onMagnetContextMenu(e: Dom.ContextMenuEvent) {
|
||||
if (this.options.preventDefaultContextMenu) {
|
||||
const view = this.findView(e.target)
|
||||
if (this.isPreventDefaultContextMenu(view)) {
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
this.handleMagnetEvent(e, (view, e, magnet, x, y) => {
|
||||
view.onMagnetContextMenu(e, magnet, x, y)
|
||||
})
|
||||
|
@ -947,7 +947,7 @@ export namespace Edge {
|
||||
port?: string
|
||||
}
|
||||
|
||||
export type TerminalData = TerminalPointData | TerminalCellData
|
||||
export type TerminalData = TerminalPointData | TerminalCellLooseData
|
||||
|
||||
export function equalTerminals(a: TerminalData, b: TerminalData) {
|
||||
const a1 = a as TerminalCellData
|
||||
|
@ -157,27 +157,31 @@ export class Model extends Basecoat<Model.EventArgs> {
|
||||
|
||||
protected onEdgeTerminalChanged(edge: Edge, type: Edge.TerminalType) {
|
||||
const ref = type === 'source' ? this.outgoings : this.incomings
|
||||
const prev = edge.previous<Edge.TerminalCellData>(type)
|
||||
const prev = edge.previous<Edge.TerminalCellLooseData>(type)
|
||||
|
||||
if (prev && prev.cell) {
|
||||
const cache = ref[prev.cell]
|
||||
const cellId = Cell.isCell(prev.cell) ? prev.cell.id : prev.cell
|
||||
const cache = ref[cellId]
|
||||
const index = cache ? cache.indexOf(edge.id) : -1
|
||||
if (index >= 0) {
|
||||
cache.splice(index, 1)
|
||||
if (cache.length === 0) {
|
||||
delete ref[prev.cell]
|
||||
delete ref[cellId]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const terminal = edge.getTerminal(type) as Edge.TerminalCellData
|
||||
const terminal = edge.getTerminal(type) as Edge.TerminalCellLooseData
|
||||
if (terminal && terminal.cell) {
|
||||
const cache = ref[terminal.cell] || []
|
||||
const terminalId = Cell.isCell(terminal.cell)
|
||||
? terminal.cell.id
|
||||
: terminal.cell
|
||||
const cache = ref[terminalId] || []
|
||||
const index = cache.indexOf(edge.id)
|
||||
if (index === -1) {
|
||||
cache.push(edge.id)
|
||||
}
|
||||
ref[terminal.cell] = cache
|
||||
ref[terminalId] = cache
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,24 +9,44 @@ export const connection: Attr.Definition = {
|
||||
qualify: isEdgeView,
|
||||
set(val, args) {
|
||||
const view = args.view as EdgeView
|
||||
const reverse = ((val as any).reverse || false) as boolean
|
||||
const stubs = ((val as any).stubs || 0) as number
|
||||
let d
|
||||
if (Number.isFinite(stubs) && stubs !== 0) {
|
||||
let offset
|
||||
if (stubs < 0) {
|
||||
const len = view.getConnectionLength() || 0
|
||||
offset = (len + stubs) / 2
|
||||
} else {
|
||||
offset = stubs
|
||||
}
|
||||
|
||||
const path = view.getConnection()
|
||||
if (path) {
|
||||
const sourceParts = path.divideAtLength(offset)
|
||||
const targetParts = path.divideAtLength(-offset)
|
||||
if (sourceParts && targetParts) {
|
||||
d = `${sourceParts[0].serialize()} ${targetParts[1].serialize()}`
|
||||
if (!reverse) {
|
||||
let offset
|
||||
if (stubs < 0) {
|
||||
const len = view.getConnectionLength() || 0
|
||||
offset = (len + stubs) / 2
|
||||
} else {
|
||||
offset = stubs
|
||||
}
|
||||
|
||||
const path = view.getConnection()
|
||||
if (path) {
|
||||
const sourceParts = path.divideAtLength(offset)
|
||||
const targetParts = path.divideAtLength(-offset)
|
||||
if (sourceParts && targetParts) {
|
||||
d = `${sourceParts[0].serialize()} ${targetParts[1].serialize()}`
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let offset
|
||||
let length
|
||||
const len = view.getConnectionLength() || 0
|
||||
if (stubs < 0) {
|
||||
offset = (len + stubs) / 2
|
||||
length = -stubs
|
||||
} else {
|
||||
offset = stubs
|
||||
length = len - stubs * 2
|
||||
}
|
||||
|
||||
const path = view.getConnection()
|
||||
d = path
|
||||
?.divideAtLength(offset)?.[1]
|
||||
?.divideAtLength(length)?.[0]
|
||||
?.serialize()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,11 @@ export class ObstacleMap {
|
||||
const excludeShapes = options.excludeShapes
|
||||
const excType = shape ? excludeShapes.includes(shape) : false
|
||||
const excTerminal = excludedTerminals.some((cell) => cell.id === node.id)
|
||||
const excNode = options.excludeNodes.includes(node)
|
||||
const excAncestor = excludedAncestors.includes(node.id)
|
||||
const excHidden = options.excludeHiddenNodes && !node.isVisible()
|
||||
const excluded = excType || excTerminal || excAncestor || excHidden
|
||||
const excluded =
|
||||
excType || excTerminal || excNode || excAncestor || excHidden
|
||||
|
||||
if (!excluded) {
|
||||
const bbox = node.getBBox().moveAndExpand(options.paddingBox)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { NumberExt } from '@antv/x6-common'
|
||||
import { Point, Rectangle, Angle } from '@antv/x6-geometry'
|
||||
import { Edge } from '../../../model'
|
||||
import { Node, Edge } from '../../../model'
|
||||
import { EdgeView } from '../../../view'
|
||||
import { orth } from '../orth'
|
||||
import { Router } from '../index'
|
||||
@ -51,6 +51,11 @@ export interface ResolvedOptions {
|
||||
*/
|
||||
excludeHiddenNodes: boolean
|
||||
|
||||
/**
|
||||
* Should certain nodes not be considered as obstacles?
|
||||
*/
|
||||
excludeNodes: Node[]
|
||||
|
||||
/**
|
||||
* Possible starting directions from a node.
|
||||
*/
|
||||
@ -141,6 +146,7 @@ export const defaults: ManhattanRouterOptions = {
|
||||
perpendicular: true,
|
||||
excludeTerminals: [],
|
||||
excludeShapes: [], // ['text']
|
||||
excludeNodes: [],
|
||||
excludeHiddenNodes: false,
|
||||
startDirections: ['top', 'right', 'bottom', 'left'],
|
||||
endDirections: ['top', 'right', 'bottom', 'left'],
|
||||
@ -221,7 +227,7 @@ export function resolveOptions(options: ManhattanRouterOptions) {
|
||||
|
||||
if (result.padding) {
|
||||
const sides = NumberExt.normalizeSides(result.padding)
|
||||
options.paddingBox = {
|
||||
result.paddingBox = {
|
||||
x: -sides.left,
|
||||
y: -sides.top,
|
||||
width: sides.left + sides.right,
|
||||
|
@ -326,6 +326,9 @@ export const router: Router.Definition<ManhattanRouterOptions> = function (
|
||||
|
||||
// Cannot found the partial route.
|
||||
if (partialRoute === null) {
|
||||
// eslint-next-line
|
||||
console.warn(`Unable to execute manhattan algorithm, use orth instead`)
|
||||
|
||||
return FunctionExt.call(
|
||||
options.fallbackRouter,
|
||||
this,
|
||||
|
@ -80,10 +80,12 @@ export class Button extends ToolsView.ToolItem<
|
||||
let tangent
|
||||
let position
|
||||
let angle
|
||||
if (NumberExt.isPercentage(distance)) {
|
||||
tangent = view.getTangentAtRatio(parseFloat(distance) / 100)
|
||||
|
||||
const d = NumberExt.normalizePercentage(distance, 1)
|
||||
if (d >= 0 && d <= 1) {
|
||||
tangent = view.getTangentAtRatio(d)
|
||||
} else {
|
||||
tangent = view.getTangentAtLength(distance)
|
||||
tangent = view.getTangentAtLength(d)
|
||||
}
|
||||
|
||||
if (tangent) {
|
||||
|
@ -15,7 +15,7 @@ export class CellEditor extends ToolsView.ToolItem<
|
||||
|
||||
render() {
|
||||
this.createElement()
|
||||
this.update()
|
||||
this.updateEditor()
|
||||
this.autoFocus()
|
||||
this.delegateDocumentEvents(this.options.documentEvents!)
|
||||
|
||||
@ -34,7 +34,7 @@ export class CellEditor extends ToolsView.ToolItem<
|
||||
this.container.appendChild(this.editor)
|
||||
}
|
||||
|
||||
update() {
|
||||
updateEditor() {
|
||||
const { graph, cell, editor } = this
|
||||
const style = editor.style
|
||||
|
||||
|
@ -58,5 +58,6 @@ export namespace Base {
|
||||
}
|
||||
return others
|
||||
},
|
||||
visible: true,
|
||||
})
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
.@{x6-prefix}-graph {
|
||||
position: relative;
|
||||
outline: none;
|
||||
touch-action: none;
|
||||
|
||||
&-background,
|
||||
&-grid,
|
||||
|
@ -65,7 +65,9 @@ export class AttrManager {
|
||||
if (normal == null) {
|
||||
normal = {}
|
||||
}
|
||||
const normalName = StringExt.kebabCase(name)
|
||||
const normalName = Dom.CASE_SENSITIVE_ATTR.includes(name)
|
||||
? name
|
||||
: StringExt.kebabCase(name)
|
||||
normal[normalName] = val as Attr.SimpleAttrValue
|
||||
}
|
||||
})
|
||||
|
@ -1975,14 +1975,24 @@ export class EdgeView<
|
||||
data: EventData.ArrowheadDragging,
|
||||
) {
|
||||
const graph = this.graph
|
||||
const snap = graph.options.connecting.snap
|
||||
const radius = (typeof snap === 'object' && snap.radius) || 50
|
||||
const views = graph.findViewsInArea({
|
||||
const { snap, allowEdge } = graph.options.connecting;
|
||||
const radius = (typeof snap === 'object' && snap.radius) || 50;
|
||||
|
||||
const findViewsOption = {
|
||||
x: x - radius,
|
||||
y: y - radius,
|
||||
width: 2 * radius,
|
||||
height: 2 * radius,
|
||||
})
|
||||
};
|
||||
|
||||
const views = graph.renderer.findViewsInArea(findViewsOption);
|
||||
|
||||
if (allowEdge) {
|
||||
const edgeViews = graph.renderer.findEdgeViewsInArea(findViewsOption).filter( view => {
|
||||
return view != this;
|
||||
});
|
||||
views.push(...edgeViews);
|
||||
}
|
||||
|
||||
const prevView = data.closestView || null
|
||||
const prevMagnet = data.closestMagnet || null
|
||||
|
@ -294,6 +294,11 @@ export class NodeView<
|
||||
portContentElement,
|
||||
)
|
||||
|
||||
let portClass = 'x6-port'
|
||||
if (port.group) {
|
||||
portClass += ` x6-port-${port.group}`
|
||||
}
|
||||
Dom.addClass(portElement, portClass)
|
||||
Dom.addClass(portElement, 'x6-port')
|
||||
Dom.addClass(portContentElement, 'x6-port-body')
|
||||
portElement.appendChild(portContentElement)
|
||||
@ -655,9 +660,18 @@ export class NodeView<
|
||||
|
||||
// Picks the node with the highest `z` index
|
||||
if (options.frontOnly) {
|
||||
candidates = candidates.slice(-1)
|
||||
if (candidates.length > 0) {
|
||||
const zIndexMap = ArrayExt.groupBy(candidates, 'zIndex')
|
||||
const maxZIndex = ArrayExt.max(Object.keys(zIndexMap))
|
||||
if (maxZIndex) {
|
||||
candidates = zIndexMap[maxZIndex]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Filter the nodes which is invisiable
|
||||
candidates = candidates.filter((candidate) => candidate.visible)
|
||||
|
||||
let newCandidateView = null
|
||||
const prevCandidateView = data.candidateEmbedView
|
||||
const validateEmbeding = options.validate
|
||||
@ -713,6 +727,7 @@ export class NodeView<
|
||||
}
|
||||
|
||||
finalizeEmbedding(e: Dom.MouseUpEvent, data: EventData.MovingTargetNode) {
|
||||
this.graph.startBatch('embedding')
|
||||
const cell = data.cell || this.cell
|
||||
const graph = data.graph || this.graph
|
||||
const view = graph.findViewByCell(cell)
|
||||
@ -733,9 +748,8 @@ export class NodeView<
|
||||
edge.updateParent({ ui: true })
|
||||
})
|
||||
|
||||
const localPoint = graph.snapToGrid(e.clientX, e.clientY)
|
||||
|
||||
if (view) {
|
||||
if (view && candidateView) {
|
||||
const localPoint = graph.snapToGrid(e.clientX, e.clientY)
|
||||
view.notify('node:embedded', {
|
||||
e,
|
||||
cell,
|
||||
@ -747,6 +761,8 @@ export class NodeView<
|
||||
currentParent: cell.getParent(),
|
||||
})
|
||||
}
|
||||
|
||||
this.graph.stopBatch('embedding')
|
||||
}
|
||||
|
||||
getDelegatedView() {
|
||||
@ -811,6 +827,9 @@ export class NodeView<
|
||||
})
|
||||
this.stopPropagation(e)
|
||||
} else {
|
||||
if (Dom.hasClass(magnet, 'x6-port-body') || !!magnet.closest('.x6-port-body')) {
|
||||
this.stopPropagation(e)
|
||||
}
|
||||
this.onMouseDown(e, x, y)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user