[etoys-dev] graphing and watching enhancements

karl ramberg karlramberg at gmail.com
Sun Mar 4 16:54:39 EST 2012

I fixed a issue with the coarse grid not behaving with offset. I had to
find the proper starting point in the count variable and things worked


twoTierGridFormOrigin: origin grid: smallGrid  background: backColor line:
lineColor darkerGridEvery: darkerGridEvery darkerGridColor: darkerGridColor
"Answer an infinite form that repeats a pattern involving grid lines with
darker ones at regular intervals, such as 'engineering paper'."

| smallGridAsPoint gridForm gridOrigin fullGrid aColor darkGridOrigin
countX countY |
smallGridAsPoint := smallGrid rounded asPoint.
fullGrid := smallGridAsPoint * darkerGridEvery.
gridForm := Form extent: fullGrid depth: Display depth.
gridOrigin := origin \\ smallGridAsPoint.
darkGridOrigin := origin \\ fullGrid.
backColor ifNotNil: [gridForm fillWithColor: backColor].
darkGridOrigin ifNotNil:[countX:=  darkGridOrigin x. countY:=
 darkGridOrigin y]
ifNil:[countX:= countY := -1].

gridOrigin x to: gridForm width by: smallGridAsPoint x do:
[:x |
aColor := (countX \\ darkerGridEvery) = 0 ifTrue: [darkerGridColor]
ifFalse: [lineColor].
gridForm fill: (x at 0 extent: 1 at gridForm height) fillColor: aColor.
countX:= countX+ 1.].
gridOrigin y to: gridForm height by: smallGridAsPoint y do:
[:y |
aColor := (countY\\ darkerGridEvery) = 0 ifTrue: [darkerGridColor] ifFalse:
gridForm fill: (0 at y extent: gridForm width at 1) fillColor: aColor.
countY:= countY+ 1.].
^ InfiniteForm with: gridForm

| aPlayfield |
aPlayfield := PasteUpMorph authoringPrototype extent: 640 @ 480.
aPlayfield color: (GraphPaperParameters twoTierGridFormOrigin: (0 at 0) grid:
16 background: Color green muchLighter line: Color blue muchLighter
darkerGridEvery: 10 darkerGridColor: Color blue muchDarker).
aPlayfield openInHand

On Sun, Mar 4, 2012 at 10:20 PM, Scott Wallace <scott.wallace at squeakland.org
> wrote:

> On Mar 3, 2012, at 5:54 AM, karl ramberg wrote:
> > ...Yes, all the stuff will be included. I fixed a couple of issues with
> graph paper and will add the rest over the weekend.
> Thank you, Karl!
> Attached now is a fileout that responds to all the issues and
> recommendations relating to the graphing tools that have appeared in the
> past few days, and cleans up a few loose ends.  Its preamble:
> Change Set:             graphingFixes-sw
> Date:                   4 March 2012
> Author:                 Scott Wallace
> Addresses various bug-reports and recommendations relating to recent
> number-line and graph-paper updates:
> - Enforce reasonable ranges for the sliders governing the grid parameters,
> taking the grid-size, coarse-grid-size , and playfield dimensions into
> account.
> - Provide a button to request 'graph paper' from the 'generic property
> sheet' when appropriate.
> - Retain position of number line when its pixelsPerUnit changes.
> - Disable the 'offset' when coarse-grid in effect.
> - Protect sliders against zero-divide that can happen if minVal = maxVal.
> - Protect InfiniteForms against incidental calls to #darker and
> #twiceDarker that can be sent to any object's fillStyle by some of the
> custom border code.
> - Removes about a dozen superfluous methods that had mistakenly lingered
> in the earlier updates, and removes three inst vars of NumberLineMorph that
> were remnants from earlier code….
> -----------
> Sorry this was just a little too late to make it into update 2398, but
> hopefully these cleanups can get pushed out soon; it wouldn't be good for
> users to start using the graphing tools before these fixes are in.
> Thanks again!
>  -- Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/etoys-dev/attachments/20120304/1ed86c19/attachment.html>

More information about the etoys-dev mailing list