Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问如何自定义初始化缩放大小,是否开启移动的功能 #14

Open
ITDragonBlog opened this issue Nov 8, 2021 · 2 comments

Comments

@ITDragonBlog
Copy link

编程语言是kotlin,目前初始化生成的思维导图很小,大概缩放比是50%。

@guaishouN
Copy link
Owner

初始化主要思想是将整个图都显示出来。可以截个图看看

@raintang666
Copy link

public void setScalePercentAndCenterY(float scalePercent){
float[] centerM = new float[9];
if(centerMatrix==null){
TreeViewLog.e(TAG, "no centerMatrix!!!");
return;
}
centerMatrix.getValues(centerM);
float[] now = new float[9];
getMatrix().getValues(now);
TreeViewLog.e(TAG, "setScalePercent: \n"
+ Arrays.toString(centerM)+"\n"
+ Arrays.toString(now));
centerM[Matrix.MSCALE_X] = scalePercent;
centerM[Matrix.MSCALE_Y] = scalePercent;
TreeViewLog.e("测量高度",getHeight()+"");
float centerY = (getScreenHeight() - getMeasuredHeight()) / 2f * scalePercent;
if(now[Matrix.MSCALE_X]>0&&now[Matrix.MSCALE_Y]>0){
animate()
.scaleX(centerM[Matrix.MSCALE_X])
.translationX(0f)
.scaleY(centerM[Matrix.MSCALE_Y])
.translationY(centerY)
.setDuration(DEFAULT_FOCUS_DURATION)
.start();
}
}
在TreeViewContainer里面加个方法 我这里是设置缩放比例和Y轴居中 不要Y轴居中的话可以把translationY删了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants