[squeak-dev] The Inbox: Morphic-kfr.1620.mcz
karl ramberg
karlramberg at gmail.com
Tue Feb 4 19:25:10 UTC 2020
Hi
I moved the previous commit to treated.
Threshold is same as for deleting by dropping vertices on top of each
other: 3
Maybe it should be bigger to be convenient, you can test changing the value
here:
PolygonMorph>>dropVertex:event:fromHandle
...
(otherMorphsVertex dist: p) < 3
ifTrue: [vertices at: ix put: otherMorphsVertex]
Best,
Karl
On Tue, Feb 4, 2020 at 8:05 PM Thiede, Christoph <
Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
> Wow, I did not know that you can overwrite an existing commit in the
> inbox :o
>
>
> Unfortunately, I can't reproduce the feature. How do I use the snapping
> after activating it in the menu? Probably the threshold is too small for a
> visible effect on a 250 % DPI screen.
>
> Best,
> Christoph
> ------------------------------
> *Von:* Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im
> Auftrag von karl ramberg <karlramberg at gmail.com>
> *Gesendet:* Dienstag, 4. Februar 2020 19:55:12
> *An:* The general-purpose Squeak developers list
> *Betreff:* Re: [squeak-dev] The Inbox: Morphic-kfr.1620.mcz
>
> Hi,
> Thanks for checking.
> The method had gone into the wrong category so it was in wrong package
> (Etoys). :-(
> I'll move the method to the right category and reupload
>
> Best,
> Karl
>
> On Tue, Feb 4, 2020 at 6:34 PM Thiede, Christoph <
> Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
>
>> Nice idea :-)
>>
>>
>> But when I merge this commit, it misses #snapToOtherPolygonPhrase:
>>
>>
>>
>>
>> Btw, #snapToOtherPolyongs itself is also absent in my image. Are you
>> depending on another inbox commit?
>>
>>
>> Best,
>>
>> Christoph
>>
>>
>> ------------------------------
>> *Von:* Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im
>> Auftrag von commits at source.squeak.org <commits at source.squeak.org>
>> *Gesendet:* Dienstag, 4. Februar 2020 17:56:00
>> *An:* squeak-dev at lists.squeakfoundation.org
>> *Betreff:* [squeak-dev] The Inbox: Morphic-kfr.1620.mcz
>>
>> A new version of Morphic was added to project The Inbox:
>> http://source.squeak.org/inbox/Morphic-kfr.1620.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Morphic-kfr.1620
>> Author: kfr
>> Time: 4 February 2020, 5:55:31.268512 pm
>> UUID: 741c35fd-d7ac-e54b-9199-ed1dda9e4df9
>> Ancestors: Morphic-kfr.1619
>>
>> Enhancement for PolygonMorph. When a vertex is dropped it will snap if it
>> is close to another PolygonMorphs vertex. It is possible to toggle
>> functionality on/ off in menu
>>
>> =============== Diff against Morphic-kfr.1619 ===============
>>
>> Item was changed:
>> BorderedMorph subclass: #PolygonMorph
>> + instanceVariableNames: 'vertices closed filledForm arrows
>> arrowForms smoothCurve curveState borderDashSpec handles borderForm
>> snapToOtherPolygons'
>> - instanceVariableNames: 'vertices closed filledForm arrows
>> arrowForms smoothCurve curveState borderDashSpec handles borderForm'
>> classVariableNames: ''
>> poolDictionaries: ''
>> category: 'Morphic-Basic'!
>>
>> !PolygonMorph commentStamp: 'md 2/24/2006 20:34' prior: 0!
>> This class implements a morph which can behave as four different
>> objects depending on the the following two facts:
>> - is it OPEN or CLOSED?
>> - is it SEGMENTED or SMOOTHED.
>>
>> 1. The OPEN and SEGMENTED variant looks like polyline.
>>
>> 2. The OPEN and SMOOTHED variant looks like spline (kind of curve)
>>
>> 3. The CLOSED and SEGMENTED variant looks like polygon. This is
>> actually what you get when you do
>> PolygonMorph new openInWorld
>> You get a triangle. See below how to manipulate these objects...
>>
>> 4. The CLOSED and SMOOTHED variant looks like blob (???)
>>
>> Prototypes of this morph can also be found in "Object Catalog". Several
>> (different variants) of this object are among "Basic" morphs.
>>
>> Explore the assiciated morph-menu. It enables you
>> - to toggle showing of "handles". They make it possible to
>> - reposition already existing vertices (by moving yellow handles)
>> - create new vertices (by moving green handles)
>> - delete already existing vertices (by dragging and dropping one
>> yellow handle closely
>> nearby the adjacent yellow handle
>> Handles can be made visible/hidden by shift+leftclicking the morph.
>> This way it is possible
>> to quickly show handles, adjust vertices and then again hide handles.
>> - making closed polygon open, i.e. converting it to a curve (and vice
>> versa)
>> - toggle smoothed/segmented line/outline
>> - set up custom dashing (for line, curves or borders of closed polygons
>> - set up custom arrow-heads (for lines resp. curves)
>>
>>
>> ------------------------------------------------------------------------------------------
>> Implementation notes:
>>
>> This class combines the old Polygon and Curve classes.
>>
>> The 1-bit fillForm to make display and containment tests reasonably
>> fast. However, this functionality is in the process of being supplanted by
>> balloon capabilities, which should eventually provide anti-aliasing as well.
>>
>> wiz 7/18/2004 21:26
>> s have made some changes to this class to
>>
>> 1) correct some bugs associated with one vertex polygons.
>>
>> 2) prepare for some enhancements with new curves.
>>
>> 3) add shaping items to menu.!
>>
>> Item was changed:
>> ----- Method: PolygonMorph>>addCustomMenuItems:hand: (in category
>> 'menu') -----
>> addCustomMenuItems: aMenu hand: aHandMorph
>> "Add morph-specific items to the given menu which was invoked by
>> the given hand. This method provides is invoked both from the halo-menu
>> and from the control-menu regimes."
>>
>> super addCustomMenuItems: aMenu hand: aHandMorph.
>> aMenu addUpdating: #handlesShowingPhrase target: self action:
>> #showOrHideHandles.
>> vertices size > 2 ifTrue:
>> [aMenu addUpdating: #openOrClosePhrase target: self
>> action: #makeOpenOrClosed].
>>
>> aMenu addUpdating: #smoothPhrase target: self action:
>> #toggleSmoothing.
>> + aMenu addUpdating: #snapToOtherPolygonPhrase target: self
>> action: #toggleSnapToOtherPolygons.
>> aMenu addLine.
>> aMenu add: 'specify dashed line' translated action:
>> #specifyDashedLine.
>>
>> self isOpen ifTrue:
>> [aMenu addLine.
>> aMenu addWithLabel: '---' enablement: [self isOpen and:
>> [arrows ~~ #none]] action: #makeNoArrows.
>> aMenu addWithLabel: '-->' enablement: [self isOpen and:
>> [arrows ~~ #forward]] action: #makeForwardArrow.
>> aMenu addWithLabel: '<--' enablement: [self isOpen and:
>> [arrows ~~ #back]] action: #makeBackArrow.
>> aMenu addWithLabel: '<->' enablement: [self isOpen and:
>> [arrows ~~ #both]] action: #makeBothArrows.
>> aMenu add: 'customize arrows' translated action:
>> #customizeArrows:.
>> (self hasProperty: #arrowSpec)
>> ifTrue: [aMenu add: 'standard arrows' translated
>> action: #standardArrows]].!
>>
>> Item was changed:
>> ----- Method: PolygonMorph>>dropVertex:event:fromHandle: (in category
>> 'editing') -----
>> + dropVertex: ix event: evt fromHandle: handle
>> + "Leave vertex in new position. If dropped ontop another vertex
>> delete
>> + this one.
>> - dropVertex: ix event: evt fromHandle: handle
>> - "Leave vertex in new position. If dropped ontop another vertex
>> delete this one.
>> Check for too few vertices before deleting. The alternative
>> + is not pretty -wiz"
>> + | p world |
>> - is not pretty -wiz"
>> - | p |
>> p := vertices at: ix.
>> +
>> + "snap the dropped vertex to a vertex of another PolygonMorph if
>> it is in near proximity"
>> + self isSnappingToOtherPolygons
>> + ifTrue: [world := Project current world.
>> + world submorphs
>> + do: [:each | ((each respondsTo:
>> #vertices)
>> + and: [each ~=
>> self])
>> + ifTrue: [each vertices
>> + do:
>> [:otherMorphsVertex | (otherMorphsVertex dist: p)
>> +
>> < 3
>> +
>> ifTrue: [vertices at: ix put: otherMorphsVertex]]]]].
>> (vertices size >= 2
>> and: ["check for too few vertices before
>> deleting. The alternative
>> is not pretty -wiz"
>> ((vertices atWrap: ix - 1)
>> dist: p)
>> < 3
>> or: [((vertices atWrap: ix + 1)
>> dist: p)
>> < 3]])
>> ifTrue: ["Drag a vertex onto its neighbor means delete"
>> + self deleteVertexAt: ix].
>> - self deleteVertexAt: ix .].
>> evt shiftPressed
>> ifTrue: [self removeHandles]
>> ifFalse: [self addHandles
>> "remove then add to recreate"]!
>>
>> Item was changed:
>> ----- Method: PolygonMorph>>initialize (in category 'initialization')
>> -----
>> initialize
>> "initialize the state of the receiver"
>> super initialize.
>> ""
>> vertices := Array
>> with: 5 @ 0
>> with: 20 @ 10
>> with: 0 @ 20.
>> closed := true.
>> smoothCurve := false.
>> arrows := #none.
>> + snapToOtherPolygons := false.
>> self computeBounds!
>>
>> Item was added:
>> + ----- Method: PolygonMorph>>isSnappingToOtherPolygons (in category
>> 'access') -----
>> + isSnappingToOtherPolygons
>> + ^snapToOtherPolygons ifNil:[ snapToOtherPolygons := false].
>> + !
>>
>> Item was added:
>> + ----- Method: PolygonMorph>>toggleSnapToOtherPolygons (in category
>> 'menu') -----
>> + toggleSnapToOtherPolygons
>> + ^snapToOtherPolygons := snapToOtherPolygons not!
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200204/44422b44/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 107564 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200204/44422b44/attachment-0001.png>
More information about the Squeak-dev
mailing list
|