The method Path.Line.translate() does not update the segments of the path - paperjs

I am working on a project using paper.js (0.11.8) and I am trying to move a single Path.Line using the provided translate() method. Although the line is moved on the canvas as expected, its segments (e.g. firstSegment.point) are not updated whereas the position is set correctly. Is this a bug or a feature? ;)
Thanks

Related

Editing PKDrawing in PencilKit

When using PencilKit in iOS 13/iPadOS, how do you change the content in PKDrawing? For example, can I go through all the lines and change the color or width of the lines? Or for selected lines (via lasso)? Or add a straight line in our own code?
PKDrawing is listed as an Opaque data object. See this Wikipedia Link for an explanation of opaque data object. Unfortunately strokes are not exposed to us. Our only 2 options currently can be found in the docs under Modifying the Drawing. Basically we can only apply a transform or append drawings in the current api. In Apple's Demo, they show how to implement undo using the append method. If you download the demo, see func setNewDrawingUndoable(_ newDrawing: PKDrawing) to see how you can implement undo.
You can set the built-in selectors undo: and redo: to the first responder of the View Controller.
WWDC 19 has a demo has an example that does that in the storyboard itself. Here's the link for you:
https://developer.apple.com/documentation/pencilkit/drawing_with_pencilkit

Lines not showing up in osgEarth & Qt

I am attempting to use osgEarth in a Qt (5.12) application on Windows, and I am having some trouble with it showing lines - as in, they are simply not showing up.
Following some of the instructions to build osg, osgQt, and osgEarth here on Stack Overflow, I managed to get everything to build and run.
If I run the osgearth_windows with the annotation.earth file, it runs fine, and I see some shapes with borders, and a few lines on the globe.
If I run with my osgQt app, I see the shapes and labels, but no borders on shapes or separate lines.
I'm curious if anyone has experienced this previously, and if there are some settings I should be doing with Qt that will resolve this issue.
Similarly, if I try some of built osgEarth sample programs, such as the osgearth_features.exe, I will see the globe and yellow borders around every country. If I follow the code in there, (the way it creates a Map, then loads the basemap, then the FeatureSoureLayer, etc), I can see the globe, and labels in my Qt app, but still no lines.
Again, I have also had another at another Stack Overflow question (How to add osgEarth Features at runtime?) and tried the solution of adding a PolygonSymbol to the Map. I can see the green triangle, but do not see the border on it.
Any help would be greatly appreciated!
Make sure you are calling this:
#include <osgEarth/GLUtils>
...
GLUtils::setGlobalDefaults(camera->getOrCreateStateSet());
Where camera is the camera in the main view, or another node at the top of the scene graph.
The shader that renders lines needs some default uniform values to be initialized. This code does that.

Adobe Extendscript Photoshop Guides Visibility

Is there a way via extendscript (jsx) to get the visibility status of Photoshop' guides?
The code to show and hide the guides is the same code as it 'toggles' the guides on or off so it must know the status when this code is executed, but how do I get at it?
I appreciate this could be done via a preference switch but that seems an awkward hack for something this simple, especially as something somewhere must be accessing this 'property' during execution of the 'toggle' code.
What would be great is to have activeDocument.guides.visible property, returning either true or false. Is there anything like that?
EDIT:
OK. Further investigation reveals that creating a guide using guides.add does not automatically toggle guides ON, however, using the code generated via the scriptListener does.
I would rather use guides.add as its only one line of code compared to fourteen so in order to toggle the guides to ON I thought I could run a function that created and then deleted a guide using the scriptListener code during the onLoad of the HTML.
This works great, except getting this function to run only when a document is opened is now the new problem.
documentAfterActivate is supposed to be the code to do this except it doesn't work unless a flash panel such as kuler is opened first.
So the question now is really what part of the flash code is allowing documentAfterActivate to work properly and how can I use it in my code instead of opening a flash panel I don't need?
It doesn't look like you've got a direct toggle option. You'd need to record the position of the guides somewhere and use script listener code to clear them when you wanted to toggle them off and use the add method on the Guides object to re-add them.
Keep in mind that even getting to the guide position via the photoshop DOM wasn't avail before CS4 I think? maybe CS5.
And i realised I just mis-read your question quite a bit. Anyway, this way you'd also know if the guides were visible based on whether or not they are there :) But yes, it isn't as nice as it could be.
The solution:
As stated, the workaround is to create and delete a guide with the fourteen lines of code from the scriptListener.
This toggles the guide visibility to ON regardless of its current state.
I can then save this status as a preference using putCustomOptions.
A function to do this is fired during the onLoad of the HTML but only when a document is opened otherwise guide creation fails.
documentAfterActivate does not work as expected unless a further flash panel (such as Kuler) is also opened beforehand.
An alternative to documentAfterActivate is to register the open event using CSevent instead.
The code can be found HERE.

TTTAttributedLabel : issue detecting links.

I've been having some issues while using TTTAttributedLabel. Sometimes a given URL doesn't get coloured as a link nor does it react to touch. However, this is solved by scrolling down and up, so by making the Cell view re-draw. I've looking at the issues in the project's github, but the ones that seemed related were already closed.
Well, the fix was to move the
.enabledTextCheckingTypes = NSTextCheckingTypeLink;
to the awakeFromNib method the custom UITableViewCell.

Specific way of selecting a location on a google map

I've inherited a small project. The person before me created a native app for iPhone, implemented in objective-c, and my job is to remake it as a webapp with PhoneGap for iOS and Android.
In my predecessor's original implementation, part of the app has the functionality of allowing the user to drop a marker on a map to select a location. I found a comparable way of doing this, but the supervisor wants the exact way she'd done it, which I'm having a little trouble with. Let me describe:
In her native app, the map appears with a marker in the center of it. The user then slides the map around beneath the marker (which stays in place on the screen), until the marker is positioned over the spot they want. Then they hit a button marked "Select," and those coordinates are sent to the app for irrelevant other operations.
I'm trying to do the exact same thing with the google-maps javascript api and html/css, and I can't figure it out. Do any of you Gmaps pros have any ideas?
You may observe the center_changed-Event of the map. When it fires set the position of the marker to the new center of the map.
Another suggestion:
For a better effect instead of a marker you may use a custom control. You may insert a marker-image there so it will look like a marker. To place it in the center, push the control to
map.controls[google.maps.ControlPosition.RIGHT_CENTER]
(it will be vertically centered then) and apply the horizontal centering by adding a right-margin to the control

Resources