Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 77D55200BB7 for ; Wed, 26 Oct 2016 04:37:30 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 76758160AFA; Wed, 26 Oct 2016 02:37:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 95A27160AD8 for ; Wed, 26 Oct 2016 04:37:29 +0200 (CEST) Received: (qmail 34695 invoked by uid 500); 26 Oct 2016 02:37:28 -0000 Mailing-List: contact dev-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list dev@flex.apache.org Received: (qmail 34679 invoked by uid 99); 26 Oct 2016 02:37:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2016 02:37:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B121F1806C2 for ; Wed, 26 Oct 2016 02:37:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.679 X-Spam-Level: * X-Spam-Status: No, score=1.679 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id idFnl3DmA5Za for ; Wed, 26 Oct 2016 02:37:26 +0000 (UTC) Received: from mail-it0-f53.google.com (mail-it0-f53.google.com [209.85.214.53]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id BF4AE5F1BE for ; Wed, 26 Oct 2016 02:37:25 +0000 (UTC) Received: by mail-it0-f53.google.com with SMTP id m138so4865261itm.1 for ; Tue, 25 Oct 2016 19:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=INyGJ6zH3JGDXJPmLU4hI2ZfVU1jR28BPowceUP3WP8=; b=rCSTknXwGm1JRocuxf8AL5R40o/UeoAdtt8JmlzPJIvFkSs96Zer/ITSKmWC3EjOOk /oiZpfJlskxULUDcOCNI/yJVOCu4zDF728VPgW9CNQZ9vQNNj8dG3urs/4BMhWuEb51I AUQQjzq59cVmrf4bGme4rg3rkOqKGr815kIGnp/+vfxC2jFj9pmBBWswwAyj9YvingVp LX7pnNWZop2uf25PtzE8CHvEoKmM+8VU2VzXLzFoNthzdxkN7bk5ivAdZ1KTGDDBggRs Vtuc8Xz37kh0RbjciuftjE9dqGkByYohgtIJsQqs7zBw6SNAKWHM7rol4qTbSY9WTqda IrNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=INyGJ6zH3JGDXJPmLU4hI2ZfVU1jR28BPowceUP3WP8=; b=KwJCivpodif5EpTL8TabZkQPsbB3W6iZ8QCwUR94ALjWSKcJ2EIvaBctTF3dA/uxJ7 oPbnojoiop0mfgrkW1lZijGtql5O9gvo75aZw9j8lCIV1UcbuycmrD5DXXpmhDMjCK/W 5qeTtHoH5szIzg+SRktXGXaM+Gocq2RvgozcEPMHEEzJudbWUAB2q9Zdz6ZvBv9GY7m4 /F0dAww9dbd19nRNN85bj1f+LNq5tUz8EVzNMbRj0OflWUfUv1Oeq33xQxnqLjyPiHze HI0TGERqK7V0I8hZEIjeNKd0dyf0E0Ry4QY4QdYMDd91oQeO8g5V4G1udcPPcNtOnz/a G8Dg== X-Gm-Message-State: ABUngvehI4sArYnp2pGI6ZNKFURszNyT2Hmc632JYM+S8BwhcGTcr9Jwj7jz6FYNYfhT3v1qdOLRCzoEAv0DGQ== X-Received: by 10.36.73.90 with SMTP id z87mr4137355ita.7.1477449439164; Tue, 25 Oct 2016 19:37:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.135.22 with HTTP; Tue, 25 Oct 2016 19:36:48 -0700 (PDT) From: jude Date: Tue, 25 Oct 2016 21:36:48 -0500 Message-ID: Subject: How to make InlineGraphicElements display a hand cursor To: dev Content-Type: multipart/alternative; boundary=001a1144617efec4cc053fbb80b7 archived-at: Wed, 26 Oct 2016 02:37:30 -0000 --001a1144617efec4cc053fbb80b7 Content-Type: text/plain; charset=UTF-8 I've been trying to figure out the TLF way to show a hand cursor on roll over on InlineGraphicElement and it seems the FlowElementMouseEventManager is preventing that with the _needsCtrlKey flag. This is set automatically by ContainerController when in edit mode in line ~3200: var needsCtrlKey:Boolean = (interactionManager != null && interactionManager.editingMode == EditingMode.READ_WRITE); It looks like it wasn't meant to handle much else except LinkElements. So I've been trying to come up with alternatives and maybe a long term solution. First, I tried to add an event mirror to the IGE to set the Mouse cursor manually: inlineGraphicElement = editManager.insertInlineGraphic(source, null, null, options, operationState); var eventMirror:IEventDispatcher = inlineGraphicElement.tlf_internal::getEventMirror(); eventMirror.addEventListener(FlowElementMouseEvent.ROLL_OVER, flowElementRollOver); protected function flowElementRollOver(event:Event):void { Mouse.cursor = MouseCursor.BUTTON; } But the FlowElementMouseEventManager class dispatchFlowElementMouseEvent method prevents roll over events from being dispatched unless the CTRL key is down: tlf_internal function dispatchFlowElementMouseEvent(type:String, originalEvent:MouseEvent):Boolean { // Mimick old behavior, and emit only rollOut events if Ctrl key is not down if (_needsCtrlKey && !originalEvent.ctrlKey && type != FlowElementMouseEvent.ROLL_OUT) return false; } I'm thinking maybe that a property on FlowElement such as currentElement.interactiveInEditMode property. This would be false by default but if true then the CTRL is not necessary. Then we can check that and continue to dispatch all events. In the event listeners we would set the Mouse.cursor how we like. This sort of feels hacky though as you'll see from LinkElement. It places the cursor control outside of a FlowElement's class. Is it a bug that it's not dispatching events I've attached listeners too? Should the CTRL key condition be removed? It seems like it's a work around for link elements and it shouldn't affect non link elements. The other approach is to mimic how LinkElement handles it. /** @private * The ElementMouseEventManager calls this method directly. Note that the mouse * coordinates are unrelated to any coordinate in the container or this element. */ tlf_internal function mouseOverHandler(mgr:FlowElementMouseEventManager, evt:MouseEvent):void { mgr.setHandCursor(true); setToState(evt.buttonDown ? LinkState.ACTIVE : LinkState.HOVER); } But the code in FlowElementMouseEventManager is specific to LinkElement. It checks if the element is of type LinkElement and if not it exits out. It's not setup to handle generic element types. I then thought if I can edit or extend FlowElementMouseEventManager to handle generic types then we can extend InlineGraphicElement with the same handlers as LinkElement. But IGE are created by ParaEdit class createImage method that hard codes the instance class to an InlineGraphicElement. Next I tried to access the FlowElementMouseEventManager instance to see if I could extend it, assign my own but it's marked private in ContainerController. So no other element types can set the Mouse cursor. Should it be accessible in the textFlow like the interaction manager? Anyway, any ideas appreciated. --001a1144617efec4cc053fbb80b7--