Ticket #2212: align.patch

File align.patch, 932 bytes (added by diana, 15 years ago)
  • src/main/java/org/sophie2/base/model/text/smart/layout/HotSegmentLayout.java

    ### Eclipse Workspace Patch 1.0
    #P org.sophie2.base.model.text
     
    209209         */ 
    210210        public HotPos getHitPos(ImmPoint point, boolean isLast) { 
    211211                TextLayout awtLayout = toAwtLayout(); 
    212                 TextHitInfo hit = awtLayout.hitTestChar(point.getX(), point.getY()); 
     212                 
     213                float off = getOffset(this.text.getBegin(), awtLayout); 
     214                 
     215                TextHitInfo hit = awtLayout.hitTestChar(point.getX() - off, point.getY()); 
    213216                HotPos hitPos = TextUtils.getPos(this.text, isLast ? hit.getInsertionIndex() : hit.getCharIndex()); 
    214217                if (hitPos == null) { 
    215218                        hitPos = this.text.getEnd();