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

Handle formulas/errors in Snapping Grid dimensions #87

Conversation

symbioquine
Copy link
Collaborator

@symbioquine symbioquine commented Sep 10, 2020

Why? Avoid the need to use an external calculator for computing even spacing. e.g. if I had a 50' bed with 120 rows, I could type =(50 * 12) / 120 directly in the dimension input box to calculate the row spacing of 5" per row.

Peek 2020-09-10 09-38

Note the 10 now 4 KiB size increase. I'm not sure what the criteria for inclusion/exclusion of features should be for farmOS-map...

**Why?** Avoid the need to use an external calculator
for computing even spacing. e.g. if I had a 50' bed with
120 rows, I could type `=(50 * 12) / 120` directly in the
dimension input box to calculate the row spacing of 5" per
row.
@symbioquine
Copy link
Collaborator Author

Before:

Hash: 2c651843bac22a73b9e8
Version: webpack 4.44.0
Time: 5982ms
Built at: 09/08/2020 10:47:21 AM
        Asset      Size  Chunks                    Chunk Names
farmOS-map.js   541 KiB       0  [emitted]  [big]  main
   index.html  1.06 KiB          [emitted]         
    mapbox.js  13.4 KiB          [emitted]         
Entrypoint main [big] = farmOS-map.js
  [2] ./node_modules/ol/proj.js + 2 modules 28.5 KiB {0} [built]
      |    3 modules
 [30] ./node_modules/ol/source/Vector.js + 1 modules 40.3 KiB {0} [built]
      |    2 modules
 [35] ./node_modules/ol/layer/Vector.js + 14 modules 174 KiB {0} [built]
      |    15 modules
 [56] ./node_modules/ol/geom/MultiPolygon.js + 1 modules 14.8 KiB {0} [built]
      |    2 modules
 [70] ./node_modules/ol/geom/flat/orient.js + 1 modules 7.32 KiB {0} [built]
      |    2 modules
 [71] ./node_modules/ol/style/Icon.js + 1 modules 15.4 KiB {0} [built]
      |    2 modules
 [87] ./node_modules/ol/renderer/canvas/Layer.js + 1 modules 18.6 KiB {0} [built]
      |    2 modules
[106] ./node_modules/ol/Overlay.js + 1 modules 19.9 KiB {0} [built]
      |    2 modules
[124] ./src/control/Geolocate/Geolocate.css 1.09 KiB {0} [built]
[125] ./node_modules/css-loader/dist/cjs.js!./src/control/Geolocate/Geolocate.css 697 bytes {0} [built]
[128] ./src/control/Edit/Edit.css 1.08 KiB {0} [built]
[130] ./src/behavior/google.css 1.07 KiB {0} [built]
[135] ./src/styles.css 1.06 KiB {0} [built]
[136] ./node_modules/css-loader/dist/cjs.js!./src/styles.css 1.36 KiB {0} [built]
[137] ./src/main.js + 136 modules 1.01 MiB {0} [built]
      | ./src/main.js 1.91 KiB [built]
      | ./src/instance/instance.js 1.74 KiB [built]
      | ./src/instance/defaults.js 3.82 KiB [built]
      | ./src/instance/methods/layer.js 7.25 KiB [built]
      | ./src/instance/methods/popup.js 551 bytes [built]
      | ./src/instance/methods/zoom.js 1.54 KiB [built]
      | ./src/utils/measure.js 2.09 KiB [built]
      | ./src/instance/methods/behavior.js 379 bytes [built]
      | ./src/control/Geolocate/Geolocate.js 5.05 KiB [built]
      | ./src/utils/forEachLayer.js 733 bytes [built]
      | ./src/behavior/rememberLayer.js 1.48 KiB [built]
      | ./src/styles/index.js 1.6 KiB [built]
      | ./src/projection/index.js 85 bytes [built]
      | ./src/behavior/index.js 313 bytes [built]
      | ./src/behavior/edit.js 990 bytes [built]
      |     + 122 hidden modules
    + 131 hidden modules

After:

Hash: af6b4bb8adfdec3cada6
Version: webpack 4.44.0
Time: 1138ms
Built at: 09/10/2020 9:28:05 AM
        Asset      Size  Chunks                    Chunk Names
farmOS-map.js   551 KiB       0  [emitted]  [big]  main
   index.html  1.06 KiB          [emitted]         
    mapbox.js  13.4 KiB          [emitted]         
Entrypoint main [big] = farmOS-map.js
  [2] ./node_modules/ol/proj.js + 2 modules 28.5 KiB {0} [built]
      |    3 modules
 [30] ./node_modules/ol/source/Vector.js + 1 modules 40.3 KiB {0} [built]
      |    2 modules
 [35] ./node_modules/ol/layer/Vector.js + 14 modules 174 KiB {0} [built]
      |    15 modules
 [56] ./node_modules/ol/geom/MultiPolygon.js + 1 modules 14.8 KiB {0} [built]
      |    2 modules
 [70] ./node_modules/ol/geom/flat/orient.js + 1 modules 7.32 KiB {0} [built]
      |    2 modules
 [71] ./node_modules/ol/style/Icon.js + 1 modules 15.4 KiB {0} [built]
      |    2 modules
 [87] ./node_modules/ol/renderer/canvas/Layer.js + 1 modules 18.6 KiB {0} [built]
      |    2 modules
[106] ./node_modules/ol/Overlay.js + 1 modules 19.9 KiB {0} [built]
      |    2 modules
[125] ./src/control/Geolocate/Geolocate.css 1.09 KiB {0} [built]
[126] ./node_modules/css-loader/dist/cjs.js!./src/control/Geolocate/Geolocate.css 697 bytes {0} [built]
[129] ./src/control/Edit/Edit.css 1.08 KiB {0} [built]
[131] ./src/behavior/google.css 1.07 KiB {0} [built]
[140] ./src/styles.css 1.06 KiB {0} [built]
[141] ./node_modules/css-loader/dist/cjs.js!./src/styles.css 1.36 KiB {0} [built]
[142] ./src/main.js + 136 modules 1.01 MiB {0} [built]
      | ./src/main.js 1.91 KiB [built]
      | ./src/instance/instance.js 1.74 KiB [built]
      | ./src/instance/defaults.js 3.82 KiB [built]
      | ./src/instance/methods/layer.js 7.25 KiB [built]
      | ./src/instance/methods/popup.js 551 bytes [built]
      | ./src/instance/methods/zoom.js 1.54 KiB [built]
      | ./src/utils/measure.js 2.09 KiB [built]
      | ./src/instance/methods/behavior.js 379 bytes [built]
      | ./src/control/Geolocate/Geolocate.js 5.05 KiB [built]
      | ./src/utils/forEachLayer.js 733 bytes [built]
      | ./src/behavior/rememberLayer.js 1.48 KiB [built]
      | ./src/styles/index.js 1.6 KiB [built]
      | ./src/projection/index.js 85 bytes [built]
      | ./src/behavior/index.js 313 bytes [built]
      | ./src/behavior/edit.js 990 bytes [built]
      |     + 122 hidden modules
    + 136 hidden modules

@symbioquine
Copy link
Collaborator Author

With @emmetio/math-expression instead of math-expression-evaluator:

Hash: 23e0532336c853e6590a
Version: webpack 4.44.0
Time: 1101ms
Built at: 09/10/2020 10:39:19 AM
        Asset      Size  Chunks                    Chunk Names
farmOS-map.js   545 KiB       0  [emitted]  [big]  main
   index.html  1.06 KiB          [emitted]         
    mapbox.js  13.4 KiB          [emitted]         
Entrypoint main [big] = farmOS-map.js
  [2] ./node_modules/ol/proj.js + 2 modules 28.5 KiB {0} [built]
      |    3 modules
 [30] ./node_modules/ol/source/Vector.js + 1 modules 40.3 KiB {0} [built]
      |    2 modules
 [35] ./node_modules/ol/layer/Vector.js + 14 modules 174 KiB {0} [built]
      |    15 modules
 [56] ./node_modules/ol/geom/MultiPolygon.js + 1 modules 14.8 KiB {0} [built]
      |    2 modules
 [70] ./node_modules/ol/geom/flat/orient.js + 1 modules 7.32 KiB {0} [built]
      |    2 modules
 [71] ./node_modules/ol/style/Icon.js + 1 modules 15.4 KiB {0} [built]
      |    2 modules
 [87] ./node_modules/ol/renderer/canvas/Layer.js + 1 modules 18.6 KiB {0} [built]
      |    2 modules
[106] ./node_modules/ol/Overlay.js + 1 modules 19.9 KiB {0} [built]
      |    2 modules
[124] ./src/control/Geolocate/Geolocate.css 1.09 KiB {0} [built]
[125] ./node_modules/css-loader/dist/cjs.js!./src/control/Geolocate/Geolocate.css 697 bytes {0} [built]
[128] ./src/control/Edit/Edit.css 1.08 KiB {0} [built]
[130] ./src/behavior/google.css 1.07 KiB {0} [built]
[135] ./src/styles.css 1.06 KiB {0} [built]
[136] ./node_modules/css-loader/dist/cjs.js!./src/styles.css 1.36 KiB {0} [built]
[137] ./src/main.js + 138 modules 1.02 MiB {0} [built]
      | ./src/main.js 1.91 KiB [built]
      | ./src/instance/instance.js 1.74 KiB [built]
      | ./src/instance/defaults.js 3.82 KiB [built]
      | ./src/instance/methods/layer.js 7.25 KiB [built]
      | ./src/instance/methods/popup.js 551 bytes [built]
      | ./src/instance/methods/zoom.js 1.54 KiB [built]
      | ./src/utils/measure.js 2.09 KiB [built]
      | ./src/instance/methods/behavior.js 379 bytes [built]
      | ./src/control/Geolocate/Geolocate.js 5.05 KiB [built]
      | ./src/utils/forEachLayer.js 733 bytes [built]
      | ./src/behavior/rememberLayer.js 1.48 KiB [built]
      | ./src/styles/index.js 1.6 KiB [built]
      | ./src/projection/index.js 85 bytes [built]
      | ./src/behavior/index.js 313 bytes [built]
      | ./src/behavior/edit.js 990 bytes [built]
      |     + 124 hidden modules
    + 131 hidden modules

@mstenta
Copy link
Member

mstenta commented Sep 21, 2020

Cool feature @symbioquine!

My only reservation is that it feels a bit like an "easter egg". :-)

I'm generally hesitant to add code unless I know it will be used. I'm sure this will be handy, but if I were looking at the map for the first time I probably wouldn't know this feature existed. Certainly adding some documentation to https://farmos.org/guide/areas/ would help. I wonder if there's anything we could do in the UI itself to make it apparent?

It actually makes me think about this: #14 (comment)

Perhaps if we create a sidebar, we can consider moving some controls (including the snapping grid) into it, and provide some help text with it.

@symbioquine
Copy link
Collaborator Author

My only reservation is that it feels a bit like an "easter egg". :-)

Yeah, I can see that :)

Certainly adding some documentation to https://farmos.org/guide/areas/ would help.

Definitely was planning on this.

I wonder if there's anything we could do in the UI itself to make it apparent?

I'll play around and see what I can come up with...

@mstenta mstenta closed this Feb 8, 2021
@mstenta mstenta deleted the branch farmOS:master February 8, 2021 15:21
@mstenta
Copy link
Member

mstenta commented Feb 8, 2021

Oops - I changed the default branch to 1.x - forgot that this would affect open PRs. :-(

@mstenta
Copy link
Member

mstenta commented Feb 8, 2021

Sorry @symbioquine! You can open a new PR against 1.x if you'd like...

@symbioquine
Copy link
Collaborator Author

Yeah, no worries @mstenta I'm not sure when I'll get back to this...

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

Successfully merging this pull request may close these issues.

2 participants