Skip to content

Added support for dynamic fractal#135

Open
masterchief1604 wants to merge 6 commits intodevelopmentfrom
dynamic_fractal
Open

Added support for dynamic fractal#135
masterchief1604 wants to merge 6 commits intodevelopmentfrom
dynamic_fractal

Conversation

@masterchief1604
Copy link

No description provided.

child: GestureDetector(
onTapDown: (details) {
setState(() {
var aspectRatio = MediaQuery.of(context).size.width /
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coordinate calculations in onTapDown and onScaleUpdate are complex and could perhaps be abstracted into reusable utility functions, such as calculateOffset or adjustZoom.

// this changes the zoom and offset

if (details.scale != 1.0) {
var zoomFactor = details.scale < 1.0 ? 1.01 : 0.99;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several ‘magic’ values in the code (1.01, 0.99, 0.001, 0.5, etc.). These should be extracted into constants with descriptive names to improve readability and ease of tuning.

child: GestureDetector(
onTapDown: (details) {
setState(() {
var aspectRatio = MediaQuery.of(context).size.width /
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MediaQuery.of(context) is called multiple times. Store it in a local variable to improve performance.

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

Successfully merging this pull request may close these issues.

2 participants