Skip to content

Commit

Permalink
marking a lot of code that doesn't need to be included in the homepag…
Browse files Browse the repository at this point in the history
…e build
  • Loading branch information
davidedc committed May 27, 2020
1 parent c4516e5 commit 17c9a04
Show file tree
Hide file tree
Showing 30 changed files with 171 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/HandleMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ class HandleMorph extends Widget
context.closePath()
context.stroke()

# from Chrome code coverage - it doesn't seem tha this is used?
# TODO check and remove if not needed
drawHandle: (context) ->

# horizontal arrow
Expand Down
1 change: 1 addition & 0 deletions src/HashCalculator.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# REQUIRES globalFunctions
# this file is excluded from the fizzygum homepage build

# adapted from http://stackoverflow.com/a/7616484

Expand Down
1 change: 1 addition & 0 deletions src/SimpleDropletWdgt.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# REQUIRES HighlightableMixin
# this file is excluded from the fizzygum homepage build

# looks like a plus sign and it replaces itself with whatever you
# drop on it. It can also assign the dropped widget to a parent field
Expand Down
28 changes: 26 additions & 2 deletions src/WorldMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ class WorldMorph extends PanelWdgt
menusHelper.createSampleDashboardOpener exampleDocsFolder
menusHelper.createSampleDocOpener exampleDocsFolder

# »>> this part is excluded from the fizzygum homepage build
# some test urls:

# this one contains two actions, two tests each, but only
Expand Down Expand Up @@ -476,7 +477,6 @@ class WorldMorph extends PanelWdgt
@automator.player.runAllSystemTests()
WorldMorph.ongoingUrlActionNumber++

# »>> this part is excluded from the fizzygum homepage build
getMorphViaTextLabel: ([textDescription, occurrenceNumber, numberOfOccurrences]) ->
allCandidateMorphsWithSameTextDescription =
@allChildrenTopToBottomSuchThat (m) ->
Expand All @@ -503,6 +503,7 @@ class WorldMorph extends PanelWdgt

return mostRecentPopUp

# »>> this part is excluded from the fizzygum homepage build
# see roundNumericIDsToNextThousand method in
# Widget for an explanation of why we need this
# method.
Expand All @@ -519,20 +520,23 @@ class WorldMorph extends PanelWdgt
for eachMorphClass in listOfMorphsClasses
#console.log "bumping up ID of class: " + eachMorphClass
window[eachMorphClass].roundNumericIDsToNextThousand?()
# this part is excluded from the fizzygum homepage build <<«

# used to close temporary menus
closePopUpsMarkedForClosure: ->
@popUpsMarkedForClosure.forEach (eachMorph) =>
eachMorph.close()
@popUpsMarkedForClosure.clear()

# »>> this part is excluded from the fizzygum homepage build
# World Widget broken rects debugging
# not using it anywhere
# currently unused
brokenFor: (aWdgt) ->
# private
fb = aWdgt.fullBounds()
@broken.filter (rect) ->
rect.isIntersecting fb
# this part is excluded from the fizzygum homepage build <<«


# fullPaintIntoAreaOrBlitFromBackBuffer results into actual painting of pieces of
Expand Down Expand Up @@ -560,6 +564,9 @@ class WorldMorph extends PanelWdgt
@clippedThroughBoundsCache = @boundingBox()
return @clippedThroughBoundsCache

# using the code coverage tool from Chrome, it
# doesn't seem that this is ever used
# TODO investigate and see whether this is needed
clipThrough: ->
@checkClipThroughCache = WorldMorph.numberOfAddsAndRemoves + "-" + WorldMorph.numberOfVisibilityFlagsChanges + "-" + WorldMorph.numberOfCollapseFlagsChanges + "-" + WorldMorph.numberOfRawMovesAndResizes
@clipThroughCache = @boundingBox()
Expand All @@ -580,6 +587,9 @@ class WorldMorph extends PanelWdgt
@broken.push theRect
@duplicatedBrokenRectsTracker[theRect.toString()] = true

# using the code coverage tool from Chrome, it
# doesn't seem that this is ever used
# TODO investigate and see whether this is needed
mergeBrokenRectsIfCloseOrPushBoth: (brokenMorph, sourceBroken, destinationBroken) ->
mergedBrokenRect = sourceBroken.merge destinationBroken
mergedBrokenRectArea = mergedBrokenRect.area()
Expand Down Expand Up @@ -1185,6 +1195,7 @@ class WorldMorph extends PanelWdgt
elapsedMilliseconds = WorldMorph.currentTime - eachSteppingMorph.lastTime
millisecondsRemainingToWaitedFrame = millisBetweenSteps - elapsedMilliseconds

# when the firing time comes (or as soon as it's past):
if millisecondsRemainingToWaitedFrame <= 0
@stepWidget eachSteppingMorph

Expand Down Expand Up @@ -1235,6 +1246,7 @@ class WorldMorph extends PanelWdgt
#console.log "running a task: " + task
task()

# »>> this part is excluded from the fizzygum homepage build
sizeCanvasToTestScreenResolution: ->
@worldCanvas.width = Math.round(960 * ceilPixelRatio)
@worldCanvas.height = Math.round(440 * ceilPixelRatio)
Expand All @@ -1245,6 +1257,7 @@ class WorldMorph extends PanelWdgt
bkground.style.width = "960px"
bkground.style.height = "720px"
bkground.style.backgroundColor = "rgb(245, 245, 245)"
# this part is excluded from the fizzygum homepage build <<«

stretchWorldToFillEntirePage: ->
# once you call this, the world will forever take the whole page
Expand Down Expand Up @@ -1304,6 +1317,8 @@ class WorldMorph extends PanelWdgt
child.fullRawMoveWithin @

# WorldMorph events:

# »>> this part is excluded from the fizzygum homepage build
initVirtualKeyboard: ->
if @inputDOMElementForVirtualKeyboard
document.body.removeChild @inputDOMElementForVirtualKeyboard
Expand Down Expand Up @@ -1357,6 +1372,7 @@ class WorldMorph extends PanelWdgt

@inputDOMElementForVirtualKeyboard.addEventListener "keypress",
@inputDOMElementForVirtualKeyboardKeypressBrowserEventListener, false
# this part is excluded from the fizzygum homepage build <<«

getPointerAndWdgtInfo: (topWdgtUnderPointer = @hand.topWdgtUnderPointer()) ->
# we might eliminate this command afterwards if
Expand Down Expand Up @@ -1879,6 +1895,7 @@ class WorldMorph extends PanelWdgt
@wdgtsDetectingClickOutsideMeOrAnyOfMeChildren.clear()
@lastNonTextPropertyChangerButtonClickedOrDropped = nil

# »>> this part is excluded from the fizzygum homepage build
resetWorld: ->
@softResetWorld()
@changed() # redraw the whole screen
Expand All @@ -1895,6 +1912,8 @@ class WorldMorph extends PanelWdgt
# so we can see the test results while tests
# are running.
document.body.scrollTop = document.documentElement.scrollTop = 0

# this part is excluded from the fizzygum homepage build <<«

# There is something special about the
# "world" version of fullDestroyChildren:
Expand Down Expand Up @@ -2053,6 +2072,7 @@ class WorldMorph extends PanelWdgt
menu.children[7].label.setText pattern7Tick + @pattern7


# »>> this part is excluded from the fizzygum homepage build
popUpSystemTestsMenu: ->
menu = new MenuMorph @, false, @, true, true, "system tests"

Expand All @@ -2073,10 +2093,12 @@ class WorldMorph extends PanelWdgt
menu.addMenuItem "save failed screenshots", true, @automator.player, "saveFailedScreenshots", "save failed screenshots"

menu.popUpAtHand()
# this part is excluded from the fizzygum homepage build <<«

create: (aWdgt) ->
aWdgt.pickUp()

# »>> this part is excluded from the fizzygum homepage build
createNewStackElementsSizeAdjustingMorph: ->
@create new StackElementsSizeAdjustingMorph

Expand Down Expand Up @@ -2265,6 +2287,8 @@ class WorldMorph extends PanelWdgt

toggleDevMode: ->
@isDevMode = not @isDevMode
# this part is excluded from the fizzygum homepage build <<«


# This method is obsolete. It assumes a different meaning
# for "minimise" than what we have now.
Expand Down
12 changes: 12 additions & 0 deletions src/basic-data-structures/Color.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class Color
"rgba(" + Math.round(@r) + "," + Math.round(@g) + "," + Math.round(@b) + "," + @a + ")"


# »>> this part is excluded from the fizzygum homepage build
# currently unused. Also: duplicated function
prepareBeforeSerialization: ->
@className = @constructor.name
@classVersion = "0.0.1"
Expand All @@ -173,6 +175,7 @@ class Color
if !@[property].className?
if @[property].prepareBeforeSerialization?
@[property].prepareBeforeSerialization()
# this part is excluded from the fizzygum homepage build <<«

# Color copying:
copy: ->
Expand All @@ -184,6 +187,8 @@ class Color
aColor and @r is aColor.r and @g is aColor.g and @b is aColor.b


# »>> this part is excluded from the fizzygum homepage build
# currently unused
# Color conversion (hsv):
hsv: ->
# ignore alpha
Expand All @@ -209,6 +214,7 @@ class Color
h /= 6
[h, s, v]

# currently unused
set_hsv: (h, s, v) ->
# ignore alpha
# h, s and v are to be within [0, 1]
Expand Down Expand Up @@ -248,6 +254,7 @@ class Color


# Color mixing:
# currently unused
mixed: (proportion, otherColor) ->
# answer a copy of this color mixed with another color, ignore alpha
frac1 = Math.min Math.max(proportion, 0), 1
Expand All @@ -257,18 +264,21 @@ class Color
@g * frac1 + otherColor.g * frac2,
@b * frac1 + otherColor.b * frac2)

# currently unused
darker: (percent) ->
# return an rgb-interpolated darker copy of me, ignore alpha
fract = 0.8333
fract = (100 - percent) / 100 if percent
@mixed fract, new @constructor 0, 0, 0

# currently unused
lighter: (percent) ->
# return an rgb-interpolated lighter copy of me, ignore alpha
fract = 0.8333
fract = (100 - percent) / 100 if percent
@mixed fract, new @constructor 255, 255, 255

# currently unused
dansDarker: ->
# return an hsv-interpolated darker copy of me, ignore alpha
hsv = @hsv()
Expand All @@ -277,6 +287,8 @@ class Color
result.set_hsv hsv[0], hsv[1], vv
result

# this part is excluded from the fizzygum homepage build <<«

@transparent: ->
return new @ 0,0,0,0

3 changes: 3 additions & 0 deletions src/basic-data-structures/LRUCache.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ class LRUCache
keys: ->
return Object.keys @_hash

# »>> this part is excluded from the fizzygum homepage build
# unused code
values: ->
values = @keys().map (key) =>
@get key
return values.filter (v) -> v isnt undefined
# this part is excluded from the fizzygum homepage build <<«

remove: (key) ->
if @_hash[key]?
Expand Down
8 changes: 8 additions & 0 deletions src/basic-data-structures/Point.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ class Point

constructor: (@x = 0, @y = 0) ->

# »>> this part is excluded from the fizzygum homepage build
onlyContainingIntegers: ->
if Math.floor(@x) == @x and
Math.floor(@y) == @y
return true
else
return false
# this part is excluded from the fizzygum homepage build <<«


debugIfFloats: ->
return
Expand All @@ -28,6 +31,9 @@ class Point
toString: ->
Math.round(@x) + "@" + Math.round(@y)

# »>> this part is excluded from the fizzygum homepage build

# currently unused. Also: duplicated function
prepareBeforeSerialization: ->
@className = @constructor.name
@classVersion = "0.0.1"
Expand All @@ -38,6 +44,8 @@ class Point
if !@[property].className?
if @[property].prepareBeforeSerialization?
@[property].prepareBeforeSerialization()

# this part is excluded from the fizzygum homepage build <<«

# Point copying:
copy: ->
Expand Down
10 changes: 10 additions & 0 deletions src/basic-data-structures/Rectangle.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ class Rectangle
#if !@onlyContainingIntegers()
# debugger

# »>> this part is excluded from the fizzygum homepage build

# currently unused. Also: duplicated function
prepareBeforeSerialization: ->
@debugIfFloats()
@className = @constructor.name
Expand All @@ -92,6 +95,7 @@ class Rectangle
if !@[property].className?
if @[property].prepareBeforeSerialization?
@[property].prepareBeforeSerialization()
# this part is excluded from the fizzygum homepage build <<«

# Rectangle copying:
copy: ->
Expand Down Expand Up @@ -159,9 +163,12 @@ class Rectangle
@debugIfFloats()
@origin.add @corner.subtract(@origin).floorDivideBy(2)

# »>> this part is excluded from the fizzygum homepage build
# unused code
corners: ->
@debugIfFloats()
[@origin, @bottomLeft(), @corner, @topRight()]
# this part is excluded from the fizzygum homepage build <<«

extent: ->
@debugIfFloats()
Expand Down Expand Up @@ -317,6 +324,8 @@ class Rectangle
# round me by applying floor() to my origin and ceil() to my corner
@origin.floor().corner @corner.ceil()

# »>> this part is excluded from the fizzygum homepage build
# unused code
amountToTranslateWithin: (aRect) ->
@debugIfFloats()
#
Expand All @@ -329,6 +338,7 @@ class Rectangle
dx = aRect.left() - @left() if (@left() + dx) < aRect.left()
dy = aRect.top() - @top() if (@top() + dy) < aRect.top()
new Point dx, dy
# this part is excluded from the fizzygum homepage build <<«

toLocalCoordinatesOf: (aWdgt) ->
new @constructor @origin.x - aWdgt.left(),@origin.y - aWdgt.top(),@corner.x - aWdgt.left(),@corner.y - aWdgt.top()
Expand Down
Loading

0 comments on commit 17c9a04

Please sign in to comment.