Marcel Taeumel uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-mt.280.mcz ==================== Summary ==================== Name: MorphicExtras-mt.280 Author: mt Time: 4 November 2020, 4:49:48.79862 pm UUID: 47ccdbdb-b186-344f-a9e7-9f620b3028a8 Ancestors: MorphicExtras-pre.279, MorphicExtras-kfr.165, MorphicExtras-kfr.269, MorphicExtras-kfr.277 Merges some quality-of-life fixes for FatBitsPaint and storyboard books. Thanks to Karl (kfr)! =============== Diff against MorphicExtras-pre.279 =============== Item was changed: ----- Method: FatBitsPaint>>addCustomMenuItems:hand: (in category 'menu') ----- + addCustomMenuItems: aCustomMenu hand: aHandMorph + super addCustomMenuItems: aCustomMenu hand: aHandMorph. + ^ aCustomMenu add: 'fat bits paint ..' translated action: #openFatBitsPaintMenu! - addCustomMenuItems: aCustomMenu hand: aHandMorph - - super addCustomMenuItems: aCustomMenu hand: aHandMorph. - aCustomMenu - add: 'background color' translated action: #setBackgroundColor:; - add: 'pen color' translated action: #setPenColor:; - add: 'pen size' translated action: #setPenSize:; - add: 'fill' translated action: #fill; - add: 'magnification' translated action: #setMagnification:; - add: 'accept' translated action: #accept; - add: 'revert' translated action: #revert; - add: 'inspect' translated action: #inspectForm; - add: 'file out' translated action: #fileOut; - add: 'selection...' translated action: #selectionMenu:; - add: 'tools...' translated action: #toolMenu:! Item was added: + ----- Method: FatBitsPaint>>openFatBitsPaintMenu (in category 'menu') ----- + openFatBitsPaintMenu + | menu | + (menu := MenuMorph entitled: 'FatBitsPaint' translated) defaultTarget: self; + addStayUpItem; + commandKeyHandler: self. + menu add: 'background color' translated action: #setBackgroundColor:; + add: 'pen color' translated action: #setPenColor:; + add: 'pen size' translated action: #setPenSize:; + add: 'fill' translated action: #fill; + add: 'magnification' translated action: #setMagnification:; + add: 'accept' translated action: #accept; + add: 'revert' translated action: #revert; + add: 'inspect' translated action: #inspectForm; + add: 'file out' translated action: #fileOut; + add: 'selection...' translated action: #selectionMenu:; + add: 'tools...' translated action: #toolMenu:. + ^ menu popUpInWorld! Item was changed: ----- Method: GraphicalDictionaryMenu>>initializeFor:fromDictionary: (in category 'initialization') ----- initializeFor: aTarget fromDictionary: aDictionary "Initialize me for a target and a dictionary." | anIndex aButton | self baseDictionary: aDictionary. target := aTarget. coexistWithOriginal := true. self extent: 210 @ 210. self clipSubmorphs: true. self layoutPolicy: ProportionalLayout new. aButton := (IconicButton new) borderWidth: 0; labelGraphic: (ScriptingSystem formAtKey: 'TinyMenu'); color: Color transparent; actWhen: #buttonDown; actionSelector: #showMenu; target: self; setBalloonText: 'menu'. self addMorph: aButton fullFrame: (LayoutFrame fractions: (0.5 @ 0 extent: 0 @ 0) offsets: (-50 @ 6 extent: aButton extent)). aButton := (SimpleButtonMorph new) target: self; borderColor: Color black; label: 'Prev'; actionSelector: #downArrowHit; actWhen: #whilePressed; setBalloonText: 'show previous picture'; yourself. self addMorph: aButton fullFrame: (LayoutFrame fractions: (0.5 @ 0 extent: 0 @ 0) offsets: (-24 @ 4 extent: aButton extent)). aButton := (SimpleButtonMorph new) target: self; borderColor: Color black; label: 'Next'; actionSelector: #upArrowHit; actWhen: #whilePressed; setBalloonText: 'show next pictutre'. self addMorph: aButton fullFrame: (LayoutFrame fractions: (0.5 @ 0 extent: 0 @ 0) offsets: (24 @ 4 extent: aButton extent)). self addMorph: ((UpdatingStringMorph new) contents: ' '; target: self; putSelector: #renameGraphicTo:; getSelector: #truncatedNameOfGraphic; useStringFormat; setBalloonText: 'The name of the current graphic'; yourself) fullFrame: (LayoutFrame fractions: (0 @ 0 extent: 1 @ 0) offsets: (10 @ 40 corner: -10 @ 60)). self addMorph: ((Morph new) extent: 100 @ 4; color: Color black) fullFrame: (LayoutFrame fractions: (0 @ 0 extent: 1 @ 0) offsets: (0 @ 60 corner: 0 @ 64)). formDisplayMorph := (Thumbnail new) extent: 100 @ 100; useInterpolation: true; + maxWidth: 300 minHeight: 100; - maxWidth: 3000 minHeight: 100; yourself. formDisplayMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 extent: 0@0) offsets: (8 @ 72 corner: 108 @ 172)). self addMorph: formDisplayMorph. self minimumExtent: 116@180. target ifNotNil: [(anIndex := formChoices indexOf: target form ifAbsent: []) ifNotNil: [currentIndex := anIndex]]. self updateThumbnail! Item was changed: BookMorph subclass: #StoryboardBookMorph instanceVariableNames: 'alansSliders panAndTiltFactor zoomFactor zoomController' classVariableNames: '' poolDictionaries: '' category: 'MorphicExtras-Books'! + !StoryboardBookMorph commentStamp: 'kfr 5/17/2015 23:37' prior: 0! + A BookMorph variant whose pages are instances of ZoomAndScrollMorph. + I have a control area where the user may pan, tilt and zoom over the image shown in the page. - !StoryboardBookMorph commentStamp: '<historical>' prior: 0! - A BookMorph variant whose pages are instances of ZoomAndScrollMorph. I have a control area where the user may pan, tilt and zoom over the image shown in the page. + StoryboardBookMorph new openInWorld + + Drop an picture at the book. + + Mouse + - drag up and down to tilt - - drag up and down to zoom in and out - drag left and right to pan + - shift-drag up and down to zoom in and out + + Keyboard + Arrow keys pan and tilts the image + X and Z zoom in and out + + From top left in control panel you pull out stills from diffrent zoom, tilt and pan posititons. + Drop these after eachother to make an animation script. + The numbers between the stills are playback speed, that can be edited. + Save script from the scripts halo menu. + + Playback script from controll panels halo menu. + + ! - - shift-drag up and down to tilt.! Item was changed: ----- Method: StoryboardBookMorph>>initialize (in category 'initialization') ----- initialize + newPagePrototype := ZoomAndScrollMorph new extent: 300@300. - newPagePrototype := ZoomAndScrollMorph new extent: Display extent // 3. zoomController := ZoomAndScrollControllerMorph new + setBalloonText: 'Drag in here to zoom, tilt and pan the page above'; + extent: 246@147. - setBalloonText: 'Drag in here to zoom, tilt and pan the page above'. super initialize. + zoomController openInWorld. + + "tool := RectangleMorph new extent: 250@170; layoutPolicy: TableLayout new. + tool addMorph: zoomController. - self addMorphBack: zoomController. - alansSliders := { {#changeTiltFactor: . #getTiltFactor . 'Pan and tilt sensitivity'}. {#changeZoomFactor: . #getZoomFactor . 'Zoom sensitivity'}. } collect: [ :sData | { SimpleSliderMorph new extent: 150@10; color: Color orange; sliderColor: Color gray; target: self; actionSelector: sData first; setBalloonText: sData third; adjustToValue: (self perform: sData second). sData second } ]. + alansSliders do: [ :each | tool addMorphBack: each first]. + tool openInWorld" - alansSliders do: [ :each | self addMorphBack: each first] ! Item was changed: + ----- Method: ZoomAndScrollControllerMorph>>changeKeys (in category 'as yet unclassified') ----- - ----- Method: ZoomAndScrollControllerMorph>>changeKeys (in category 'menus') ----- changeKeys upDownCodes := Dictionary new. + changeKeysState := #(up down left right in out). - changeKeysState := #(up down in out). self changed.! Item was changed: ----- Method: ZoomAndScrollControllerMorph>>initialize (in category 'initialization') ----- initialize "initialize the state of the receiver" | displayer dataMorph | super initialize. "" hasFocus := true. currentKeyDown := Set new. upDownCodes := Dictionary new. + upDownCodes at: 31 put: #up; "arrow keys" + at: 30 put: #down; + at: 29 put: #left; + at: 28 put: #right; + at: 88 put:#in; "x" + at: 90 put:#out. "y" + - upDownCodes at: 126 put: #up; - at: 125 put: #down; - at: 123 put: #out; - at: 124 put: #in. - "arrow keys on the mac" self extent: 40 @ 40; vResizing: #rigid; hResizing: #spaceFill; setBalloonText: 'Drag in here to zoom, tilt and pan the page above'. dataMorph := AlignmentMorph newColumn. dataMorph color: Color yellow; hResizing: #shrinkWrap; vResizing: #shrinkWrap. dataMorph on: #mouseDown send: #grabCameraPositionEvent:morph: to: self. displayer := UpdatingStringMorph new getSelector: #cameraPointRounded; target: self; growable: true; putSelector: nil. dataMorph addMorph: displayer lock. displayer := UpdatingStringMorph new getSelector: #cameraScale; target: self; growable: true; floatPrecision: 0.001; putSelector: nil. dataMorph addMorph: displayer lock. self addMorph: dataMorph! Item was changed: ----- Method: ZoomAndScrollControllerMorph>>step (in category 'stepping and presenter') ----- step + | delta halfDW shift | + shift := false. - | delta halfDW | - (self valueOfProperty: #currentCameraVersion ifAbsent: [0]) = self currentCameraVersion ifFalse: [ self patchOldVersion1. self setProperty: #currentCameraVersion toValue: self currentCameraVersion. ]. super step. self doProgrammedMoves. + (currentKeyDown ifNil: [#()]) do: [ :each | | action | + action := upDownCodes at: each ifAbsent: [shift := true]. - (currentKeyDown ifNil: [#()]) do: [ :each | | action | - action := upDownCodes at: each ifAbsent: [#fugeddaboutit]. action == #in ifTrue: [ target scaleImageBy: -10. ]. action == #out ifTrue: [ target scaleImageBy: 10. ]. action == #up ifTrue: [ + target panImageBy: 0@ -20. - target tiltImageBy: -20. ]. action == #down ifTrue: [ + target panImageBy: 0@20. - target tiltImageBy: 20. ]. + action == #left ifTrue: [ + target panImageBy: -20@0. + ]. + action == #right ifTrue: [ + target panImageBy: 20@0. + ]. ]. mouseMovePoint ifNil: [^self]. mouseDownPoint ifNil: [^self]. target ifNil: [^self]. halfDW := self deadZoneWidth // 2. + halfDW := self deadZoneWidth // 2. delta := mouseMovePoint - mouseDownPoint. delta x abs <= halfDW ifTrue: [delta := 0@delta y]. delta y abs <= halfDW ifTrue: [delta := delta x@0]. + shift ifTrue:[^target scaleImageBy: delta x]. + target panImageBy: delta x @ delta y - - target panImageBy: delta x. ! Item was changed: + ----- Method: ZoomAndScrollMorph>>panImageBy: (in category 'as yet unclassified') ----- - ----- Method: ZoomAndScrollMorph>>panImageBy: (in category 'transformations') ----- panImageBy: pixels + self changeOffsetBy: (pixels x* self getTiltFactor * 0.1) @ (pixels y* self getTiltFactor * 0.1) - self changeOffsetBy: (pixels * self getTiltFactor * 0.1) @ 0. "steps := (pixels abs / 6) exp rounded * pixels sign." "==Alan's preferred factors pan = 0.0425531914893617 zoom = 0.099290780141844 ===" ! Item was removed: - ----- Method: ZoomAndScrollMorph>>tiltImageBy: (in category 'transformations') ----- - tiltImageBy: pixels - - self changeOffsetBy: 0 @ (pixels * self getTiltFactor * 0.1) - - " steps := (pixels abs / 6) exp rounded * pixels sign. - " - "==Alan's preferred factors - pan = 0.0425531914893617 - zoom = 0.099290780141844 - ===" - ! |
Free forum by Nabble | Edit this page |