The Inbox: MorphicExtras-kfr.165.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: MorphicExtras-kfr.165.mcz

commits-2
A new version of MorphicExtras was added to project The Inbox:
http://source.squeak.org/inbox/MorphicExtras-kfr.165.mcz

==================== Summary ====================

Name: MorphicExtras-kfr.165
Author: kfr
Time: 17 May 2015, 11:43:15.836 pm
UUID: 6ed5bbe8-8b28-7948-a1b0-de35fcfccb0d
Ancestors: MorphicExtras-kfr.164

More cleanup to StoyboardBookMorph

=============== Diff against MorphicExtras-nice.163 ===============

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') -----
  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') -----
  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 'as yet unclassified') -----
- 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
- ==="
- !