mirror of
https://gitee.com/antv/g6.git
synced 2024-12-04 20:59:15 +08:00
fix: fix mobile event and behavior
This commit is contained in:
parent
c2428abe55
commit
668e4f88a4
@ -1,26 +0,0 @@
|
||||
module.exports = api => {
|
||||
api.cache(() => process.env.NODE_ENV);
|
||||
|
||||
if (process.env.GATSBY === 'true') {
|
||||
return {
|
||||
presets: ['@babel/preset-env', 'babel-preset-gatsby'],
|
||||
};
|
||||
}
|
||||
return {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
loose: true,
|
||||
modules: false,
|
||||
},
|
||||
],
|
||||
'@babel/preset-react',
|
||||
{
|
||||
"plugins": [
|
||||
"@babel/plugin-proposal-class-properties"
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
@ -21,7 +21,14 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "https://github.com/orgs/antvis/people",
|
||||
"files": ["package.json", "es", "lib", "dist", "LICENSE", "README.md"],
|
||||
"files": [
|
||||
"package.json",
|
||||
"es",
|
||||
"lib",
|
||||
"dist",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"miniprogram": "dist",
|
||||
"module": "es/index.js",
|
||||
@ -52,8 +59,13 @@
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.{js,jsx,ts,tsx}": ["npm run lint-staged:js", "prettier --write"],
|
||||
"**/*.{less,md,json}": ["prettier --write"]
|
||||
"**/*.{js,jsx,ts,tsx}": [
|
||||
"npm run lint-staged:js",
|
||||
"prettier --write"
|
||||
],
|
||||
"**/*.{less,md,json}": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/colors": "^5.0.1",
|
||||
|
@ -484,7 +484,7 @@ export default class TreeGraph extends Graph implements ITreeGraph {
|
||||
|
||||
this.get('canvas').animate(
|
||||
(ratio: number) => {
|
||||
traverseTree<TreeGraphData>(data, (child) => {
|
||||
traverseTree(data, (child: any) => {
|
||||
const node = self.findById(child.id);
|
||||
|
||||
// 只有当存在node的时候才执行
|
||||
|
@ -1,55 +0,0 @@
|
||||
/**
|
||||
* 调用 gpuDetector.webgl 判断当前浏览器是否支持 webgl。(支持 gpgpu 的浏览器一定也支持 webgl)
|
||||
*/
|
||||
export const gpuDetector = (): any => {
|
||||
if (typeof window === 'undefined' || typeof document === 'undefined') return {};
|
||||
return {
|
||||
canvas: !!window.CanvasRenderingContext2D,
|
||||
webgl: (() => {
|
||||
try {
|
||||
const canvas = document.createElement('canvas');
|
||||
return !!(
|
||||
window.WebGLRenderingContext &&
|
||||
(canvas.getContext('webgl') || canvas.getContext('experimental-webgl'))
|
||||
);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
})(),
|
||||
workers: !!window.Worker,
|
||||
fileapi: window.File && window.FileReader && window.FileList && window.Blob,
|
||||
getWebGLErrorMessage() {
|
||||
const element = document.createElement('div');
|
||||
element.id = 'webgl-error-message';
|
||||
element.style.fontFamily = 'monospace';
|
||||
element.style.fontSize = '13px';
|
||||
element.style.fontWeight = 'normal';
|
||||
element.style.textAlign = 'center';
|
||||
element.style.background = '#fff';
|
||||
element.style.color = '#000';
|
||||
element.style.padding = '1.5em';
|
||||
element.style.width = '400px';
|
||||
element.style.margin = '5em auto 0';
|
||||
if (!this.webgl) {
|
||||
element.innerHTML = window.WebGLRenderingContext
|
||||
? [
|
||||
'Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br />',
|
||||
'Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.',
|
||||
].join('\n')
|
||||
: [
|
||||
'Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br/>',
|
||||
'Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.',
|
||||
].join('\n');
|
||||
}
|
||||
return element;
|
||||
},
|
||||
addGetWebGLMessage(parameters) {
|
||||
parameters = parameters || {};
|
||||
const parent = parameters.parent !== undefined ? parameters.parent : document.body;
|
||||
const id = parameters.id !== undefined ? parameters.id : 'oldie';
|
||||
const element = gpuDetector().getWebGLErrorMessage();
|
||||
element.id = id;
|
||||
parent.appendChild(element);
|
||||
},
|
||||
};
|
||||
};
|
@ -38,10 +38,8 @@ module.exports = {
|
||||
return filename;
|
||||
},
|
||||
library: 'G6',
|
||||
libraryTarget: 'umd',
|
||||
libraryExport: 'default',
|
||||
libraryTarget: 'commonjs2',
|
||||
path: resolve(process.cwd(), 'dist/'),
|
||||
globalObject: 'this',
|
||||
},
|
||||
resolve: {
|
||||
// Add `.ts` as a resolvable extension.
|
||||
@ -49,27 +47,22 @@ module.exports = {
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.worker\.ts$/,
|
||||
exclude: /(node_modules)/,
|
||||
use: [
|
||||
{
|
||||
loader: 'worker-loader',
|
||||
options: {
|
||||
inline: 'fallback',
|
||||
filename: 'g6Layout.worker.js',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
include: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
// babelrc: true,
|
||||
presets: ['@babel/preset-env'],
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
esmodules: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user