Dears,
I'm experimenting with Spec, more specifically with a ImageModel. I'm tring to scale the image accordingly to the window size, but I can't find a simple way to do that. Does windows resizing trigger a "when..." message? Should I try a different solution? Thanks, Matteo View this message in context: Spec: scaling imageModels Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. |
Hi matteo
Spec does not expose the complete API. Now if you need you can propose some extensions. Stef |
Hi Stef,
I think that an automatic scaled behaviour is very useful for ImageModel, especially if you need to generate list of images, that automatically adapts to their container (i.e. Thumbnails). Playing with AlpahImageMorph I found that the desired behaviour can be obtained setting the "layout" state to the "#scaledAspect" symbol. So I've added the "ImageModel>>switchScaledLayout" method, that will simply call its MorphicAdapter, through the command "self changed: #switchScaledLayout with: {}". Then I've created the "MorphicImageAdapter>>switchScaledLayout" method, that switchs among the "#center" and "#scaledAspect" morph layouts (note: "#center" is the default for the Spec's "MorpdicImageAdapter"). Below the code the code I used: MorphicImageAdapter>>switchScaledLayout "Switch between scaled and fixed representation" self widgetDo: [ :w | | oldLayout | oldLayout := w layout. oldLayout = #scaledAspect ifTrue: [ w layout: #center ] ifFalse: [ w layout: #scaledAspect ] ]. Please let me know if you have any advice, Thanks, Matteo |
In reply to this post by stepharo
Hi Stef,
I think that an automatic scaled behaviour is very useful for ImageModel, especially if you need to generate list of images, that automatically adapts to their container (i.e. Thumbnails). Playing with AlpahImageMorph I found that the desired behaviour can be obtained setting the "layout" state to the "#scaledAspect" symbol. So I've added the "ImageModel>>switchScaledLayout" method, that will simply call its MorphicAdapter, through the command "self changed: #switchScaledLayout with: {}". Then I've created the "MorphicImageAdapter>>switchScaledLayout" method, that switchs among the "#center" and "#scaledAspect" morph layouts (note: "#center" is the default for the Spec's "MorpdicImageAdapter"). Below the code the code I used: MorphicImageAdapter>>switchScaledLayout "Switch between scaled and fixed representation" self widgetDo: [ :w | | oldLayout | oldLayout := w layout. oldLayout = #scaledAspect ifTrue: [ w layout: #center ] ifFalse: [ w layout: #scaledAspect ] ]. Please let me know if you have any advice, Thanks, Matteo -- View this message in context: http://forum.world.st/Spec-scaling-imageModels-tp4918440p4919199.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. |
Hi matteo
Please open a bug entry and submit a fix and there is a good chance that your enhancements will be added to Pharo. We cannot crawl the mails and do that in addition to all the rest. :) Stef |
Hi Stef, sorry, I didn't get it from your first mail! Have I to submit the bug entry, and the fix, thorugh "fogbugz" or GitHub? thanks, Matteo Il Giovedì 20 Ottobre 2016 9:12, stepharo <[hidden email]> ha scritto: Hi matteo Please open a bug entry and submit a fix and there is a good chance that your enhancements will be added to Pharo. We cannot crawl the mails and do that in addition to all the rest. :) Stef |
Fogbugz! Am 22.10.2016 3:08 nachm. schrieb "Matteo Bellotto via Pharo-users" <[hidden email]>:
|
In reply to this post by Pharo Smalltalk Users mailing list
Hi matteo
Please open a bug entry and submit a fix and there is a good chance that your enhancements will be added to Pharo. We cannot crawl the mails and do that in addition to all the rest. :) Stef |
Free forum by Nabble | Edit this page |