To Detent Or Not To Detentâ¦
Can anyone explain the purpose of sending #detentBy:atMultiplesOf:snap: in the method below? The problem is that, if you resize programatically below a factor of 0.1, you enter a black hole from which many scale attempts become effectively ignored. If the send is removed, everything works for my use case, but I don't understand its purpose and so don't know if it's a bug or feature! TransformationMorph>>#extent: newExtent self adjustAfter: [ | scaleFactor |scaleFactor := (self scale * newExtent r / self fullBounds extent r) max: 0.1. self scale: (scaleFactor detentBy: 0.1 atMultiplesOf: 1.0 snap: false)] ----- Cheers, Sean -- View this message in context: http://forum.world.st/To-Detent-Or-Not-To-Detent-tp4847682.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
2015-09-02 17:42 GMT+02:00 Sean P. DeNigris <sean@clipperadams.com>:
Can anyone explain the purpose of sending #detentBy:atMultiplesOf:snap: in the method below? The problem is that, if you resize programatically below a factor of 0.1, you enter a black hole from which many scale attempts become effectively ignored. If the send is removed, everything works for my use case, but I don't understand its purpose and so don't know if it's a bug or feature! TransformationMorph>>#extent: newExtent self adjustAfter: [ | scaleFactor |scaleFactor := (self scale * newExtent r / self fullBounds extent r) max: 0.1. self scale: (scaleFactor detentBy: 0.1 atMultiplesOf: 1.0 snap: false)]
Maybe it is not needed for the #extent method. It is used for rotation and scaling with the halos. For example, if you remove that call in #scaleToMatch:, it may be difficult (or impossible, due to rounding errors) to scale a Morph back to scale factor 1.0. But I think it is enough to use this in #scaleToMatch: , no need to have it in #extent: too.
----- Cheers, Sean -- View this message in context: http://forum.world.st/To-Detent-Or-Not-To-Detent-tp4847682.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (2)
-
Nicolai Hess -
Sean P. DeNigris